Let $x = (0, 1)$ and $y = (−2, a)$ be two vectors in $\Bbb R^2$, where $a$ is a real number. 
Problem:Let $x = (0, 1)$ and $y = (−2, a)$ be two vectors in $\Bbb R^2$, where $a$ is a real number.

Attempt: Please be nice.
(a) Compute the quantity $\frac{x · y}{||x||||y||}$, in terms of $a$.
$$
x·y=0(-2) + 1(a)=a 
$$
$$
||x||=\sqrt{0^2+1^2}=1
$$
$$
||y||=\sqrt{-2^2+a^2}=\sqrt{4+a^2}
$$
$$
\cos θ=\frac{x · y}{||x|| ||y||}=\frac{a}{\sqrt{4+a^2}}
$$
$$
θ=\cos^{-1}\frac{a}{\sqrt{4+a^2}}
$$
(b) Determine all values of $a$ for which the angle between $x$ and $y$ is $\frac{π}{3}$(radians).
Using a reference angle, where I have <-2,a> with an angle of $\frac{1}{2}$ (because $\frac{π}{3}$ is 60 degrees and in unit cirlce that's  $\frac{1}{2}$)
$$
tan(\frac{1}{2})=\frac{a}{-2}
$$
$$
(-2)tan(\frac{1}{2})=\frac{a}{-2}(-2)
$$
$$
(-2)tan(\frac{1}{2})=a
$$
$$
=-0.0174
$$
$$
0=a
$$
You guys have been giving me hints. But I just can't figure it out. a component is still missing. I don't know anymore.
$$
cos(\frac{1}{2})=\frac{a}{\sqrt{4+a^2}}
$$
$$
(\sqrt{4+a^2})cos(\frac{1}{2})=\frac{a}{\sqrt{4+a^2}}(\sqrt{4+a^2})
$$
$$
(\sqrt{4+a^2})cos(\frac{1}{2})=a
$$
EDITED

The angle and the dot product are related by $\cos\theta=(x\cdot y)/(\lVert x\rVert\lVert y\rVert)$. We're given $\theta=\pi/3$, and we know $\cos(\pi/3)=1/2$. And you've calculated $(x\cdot y)/(\lVert x\rVert\lVert y\rVert)=a/\sqrt{4+a^2}$. So we have this equation:
$$\frac12=\cos(\pi/3)=\cos\theta=\frac{x\cdot y}{\lVert x\rVert\lVert y\rVert}=\frac{a}{\sqrt{4+a^2}}$$
$$\frac12=\frac{a}{\sqrt{4+a^2}}$$
Squaring:
$$\left(\frac12\right)^2=\frac{a^2}{\sqrt{4+a^2\,}^2}$$
$$\frac14=\frac{a^2}{4+a^2}$$
Multiplying by $4$:
$$1=\frac{4a^2}{4+a^2}$$
Multiplying by $(4+a^2)$:
$$4+a^2=4a^2$$
Subtracting $a^2$:
$$4=3a^2$$
Dividing by $3$:
$$\frac43=a^2$$
$$a^2=\frac43=\left(\frac{2}{\sqrt3}\right)^2$$
It is a general fact that, if $a=b$ or $a=-b$, then $a^2=b^2$; and conversely, if $a^2=b^2$, then either $a=b$ or $a=-b$. I think you can find a proof of this elsewhere. Thus:
$$a=\pm\frac{2}{\sqrt3}$$
So we have two possible answers, but we need to check that they actually work:
$$\frac12\overset?=\frac{\pm2/\sqrt3}{\sqrt{4+(\pm2/\sqrt3)^2}}$$
$$=\frac{\pm2/\sqrt3}{\sqrt{4+(4/3)}}$$
$$=\frac{\pm2/\sqrt3}{\sqrt{16/3}}$$
$$=\frac{\pm2/\sqrt3}{4/\sqrt{3}}$$
$$=\pm\frac12$$
Thus only the upper sign works: $a=+2/\sqrt3$.
