<s>[INST] Solving a set of 3 Nonlinear Equations In the following 3 equations:
$$
k_1\cos^2(\theta)+k_2\sin^2(\theta) = c_1
$$
$$
2(k_2-k_1)\cos(\theta)\sin(\theta)=c_2
$$
$$
k_1\sin^2(\theta)+k_2\cos^2(\theta) = c_3
$$
$c_1$, $c_2$ and $c_3$ are given, and $k_1$, $k_2$ and $\theta$ are the unknowns. What is the best way to solve for the unknowns? Specifically, I need to solve many independent instances of this system in an algorithm. Therefore, ideally the solution method should be fast.
 [/INST] Re-write in terms of double-angle expressions, and define values $A$, $B$, $C$:
$$\begin{align}
k_1 \cos^2\theta + k_2 \sin^2\theta = c_1 &\quad\implies\quad \cos 2\theta = \frac{2 c_1-k_1-k_2}{k_1-k_2} & =: A \\[5pt]
2 \left(k_1-k_2\right) \sin\theta \cos\theta = c_2 &\quad\implies\quad \sin 2\theta = \frac{c_2}{k_1-k_2} &=: B \\[5pt]
k_1 \sin^2\theta + k_2 \cos^2\theta = c_3 &\quad\implies\quad \cos 2\theta = \frac{k_1+k_2-2c_3}{k_1-k_2} &=: C
\end{align}$$
Now, $A=C$ implies $k_1 + k_2 = c_1 + c_3$ (but we'd know that simply by adding your first and third equations together), so that $k_2 = c_1+c_3-k_1$ and
$$
A = \frac{c_1-c_3}{2k_1-c_1-c_3} \qquad\qquad
B = \frac{c_2}{2k_1-c_1-c_3}
$$
Observe that you can already write
$$\tan 2\theta = \frac{c_2}{c_1-c_3}$$
which gives you $\theta$. For $k_1$ and $k_2$, note that $A^2+B^2=1$ implies
$$(c_1-c_3)^2 + c_2^2 = \left(2k_1-c_1-c_3\right)^2$$
so that
$$\begin{align}
k_1 &= \frac{1}{2}\left( c_1+c_3 \pm \sqrt{(c_1-c_3)^2+c_2^2} \right) \\
k_2 &= \frac{1}{2}\left( c_1+c_3 \mp \sqrt{(c_1-c_3)^2+c_2^2} \right)
\end{align}$$
(I would guess that the $k_1$ and $k_2$ are simply the two roots of the quadratic ---so that, say, $k_1$'s "$\pm$" is "$+$", while $k_2$'s "$\mp$" is "$-$"--- but this ambiguity is really for you to resolve based on your circumstances.) 
</s>