I have been trying to work out this problem for hours but I cannot get it. A circle has its centre on the positive $x$-axis at $(a,0)$. The radius of this circle is $4$. Lines $y=2x$ and $y=-2x$ are tangent to the circle. I have to find the $x$-coordinate $a$.
So I get that the equation for this circle should be $(x-a)^2+y^2=16$, and then I figure that I have to substitute $2x$ in this equation for the $y$, so I would get $(x-a)^2 + 4x^2=16$. After this, I don't know what to do to get $a$. Any help? Thanks

Why not just solve the quadratic? Collect like terms in $x$ as follows. Move everything to one side to get $$(x-a)^2 + 4x^2 - 16 = 0.$$ Then expand the square: $$\begin{align} 0 &= x^2 - 2ax + a^2 + 4x^2 - 16 \\ &= 5x^2 - 2ax + a^2 - 16. \end{align}$$ Then using the quadratic formula gives you $$x = \frac{2a \pm \sqrt{(-2a)^2 - 4(5)(a^2-16)}}{2(5)} = \frac{a \pm 2\sqrt{20-a^2}}{5}.$$ This means the intersection of the line and the circle will have two solutions if $a^2 - 20 > 0$, no solutions if $a^2 - 20 < 0$, and exactly one solution if $a^2 - 20 = 0$. Since the line is supposed to be tangent, $a$ must satisfy the last case, hence $a = 2\sqrt{5}$. We take the positive value for $a$ since we know the circle's center is on the positive $x$-axis.
Alternatively, we can exploit the geometry of similar right triangles. Let $P = (x_0, 2x_0)$ be the point of tangency of the line $y = 2x$ with the circle, and let the origin be $O = (0,0)$ and the center of the circle $A = (a,0)$. Let $Q = (x_0, 0)$ be the foot of the perpendicular from $P$ to the $x$-axis. Then we have $$\triangle PQO \sim \triangle APO,$$ hence $$\frac{AP}{PO} = \frac{PQ}{QO} = \frac{2x_0}{x_0} = 2.$$ Since $AP = 4$, the radius of the circle, it follows that $PO = 2$, and by the Pythagorean theorem, $$a = AO = \sqrt{AP^2 + PO^2} = \sqrt{4^2 + 2^2} = \sqrt{20} = 2 \sqrt{5}.$$