Question: > 
> Prove that there is no irreducible polynomial of degree 2 in $\mathbb C[x]$.
> 
> 
> 

I know this result is true from the Fundamental Theorem of Algebra, which states that any polynomial in $\mathbb C[x]$ with degree $n\ge 1$, has at least $1$ root in $\mathbb C$.

However, this question is asked in the textbook before the FTA is introduced. How can I go about proving it?

Answer: 
I'm going to use $t$ instead of $f$.

The points $A + tB$ lie on a line through the point $A$ in the direction of the vector $B$. You are trying to find the values of $t$ that give you the intersections of this line with a circle $C$ of radius $M$ centered at the origin. 

If the point $A$ lies inside the circle $C$, there will be two values of $t$, one negative and one positive. If the point $A+B$ lies outside the circle $C$, then the positive $t$ value will be less than $1$.

So how to find the desired value of $t$.

We have:

\begin{align}
&A + tB \;\text{ lies on the circle } C \\
\Leftrightarrow\;& \|A + tB\| = M \\
\Leftrightarrow\;& \|A + tB\|^2 = M^2 \\
\Leftrightarrow\;& (A + tB) \cdot (A + tB) = M^2 \\
\Leftrightarrow\;& A \cdot A + 2t(A \cdot B) + t^2(B.\cdot B) = M^2 
\end{align}
The desired solution of the quadratic is:
$$
t = \frac{-A \cdot B + \sqrt{ (A \cdot B)^2 - (B.B) (A \cdot A - M^2)} } { B \cdot B}
$$

The necessary code would be:

```
double AA = x*x + y*y;     // A dot A
double BB = u*u + v*v;     // B dot B
double AB = u*x + v*y;     // A dot B

double d = sqrt(AB*AB - BB*(AA - M*M));

double t = (d - AB)/BB;

```

This is roughly the same formula you derived, but in a rather tidier form (in my opinion), and with slightly less arithmetic. I don't think you can do any better than this. The only part that will take any time is the square root, and I think this is unavoidable. You should be able to do this calculation millions of times a second, even on a wristwatch. Iterative algorithms will be much slower, as you already discovered.
Update: I tried playing with iterative approximation approaches (like G Cab mentioned) and doing a binary search to find a suitable value of $f$, but nothing could come close to the performance of simply calculating the equation directly.

I made sure to use any possible optimization (storing all intermediate steps of the calculation to reuse as much as possible, using multiplication rather than power to calculate the squares, etc).

So, unless there is an approach that doesn't involve the definition of vector magnitude, I don't think there's a better way to calculate $f$.