solve $\frac{\sqrt{5}(\cos \theta - \sin \theta)}{3\sqrt{2}}=\tan \theta$ I came across a question from another forum -
find the $x$ in the following diagram:

I managed to deduce an equation from the following diagram:

which is:
$\dfrac{\sqrt{5}(\cos \theta - \sin \theta)}{3\sqrt{2}}=\tan \theta$
and I know the answer (from WolframAlpha) is:
$\cos \theta= \dfrac{3}{\sqrt{10}}$
but I'm not able to deduce the answer myself, any ideas?
By the way, $x=2\sqrt{5}$, which can be easily deduced by:
$\dfrac{3\sqrt{2}}{x}=\cos\theta$
I also tried to solve the original question geometrically:

Somehow, I managed to figure out that $y=3$ in the above diagram, but I can't prove it either.
 A: Probably not the most elegant solution.
If you use the tangent half-angle substitution $x=\tan \left(\frac{\theta }{2}\right)$, you end with
$$\sqrt{10}\, x^4-2 \left(6-\sqrt{10}\right)\, x^3-2 \sqrt{10} \,x^2-2
   \left(6+\sqrt{10}\right) x+\sqrt{10}=0 \tag 1$$
Using the method for quartic equations, there are two real roots and one of them is
$$x=\sqrt{10}-3\implies \cos(\theta)=\frac{3}{\sqrt{10}}$$ The other roots are really messy.
A: Defining $c := \cos\theta$ and $s := \sin\theta$, we can write
$$c^2\sqrt{5} = s\left(3 \sqrt{2} + c\sqrt{5}\right) \tag{1}$$
Squaring, re-writing $s^2 = 1-c^2$, and re-arranging,
$$10 c^4 + 6 c^3 \sqrt{10} + 13 c^2 - 6c \sqrt{10} - 18 = 0 \tag{2}$$
At this point, if we had the presence of mind to identify $10$ as $\sqrt{10}^2$ and $13$ as $-27 + 4\sqrt{10}^2$, then (defining $r:=\sqrt{10}$) we could gather terms and factor
$$\begin{align}
0 &= r^2 c^4 +\left(-3r + 9 r\right)c^3 + (-27+4r^2)c^2 +(-12r+ 6r)c - 18 \\[4pt]
&= \left(r^2 c^4 - 3rc^3\right) + \left(9 rc^3 -27c^2\right)+\left(4r^2c^2 -12rc\right)+ \left(6rc - 18\right)\\[4pt]
&= \left(r c - 3 \right) \left( rc^3 + 9 c^2 +4 r c + 6 \right) \tag{3}
\end{align}$$
(That is, we have factored over $\mathbb{Q}\left[\sqrt{10}\right]$.) The first factor yields the target root, $\cos\theta = 3/\sqrt{10}$. (Note that the second factor obviously has no positive solutions.)
Without such intuition, but with a suspicion that the $\sqrt{10}$s were impeding progress to a reasonably-nice solution, we could write $(2)$ as
$$10 c^4 + 13 c^2-18 = 6c\sqrt{10}\left(1-c^2\right) \tag{4}$$
Now, squaring will eliminate the pesky $\sqrt{10}$, and we have
$$100 c^8 - 100 c^6 + 529 c^4 - 828 c^2 + 324 = 0 \tag{5}$$
From here, old-fashioned factoring gives
$$\left(10 c^2 - 9\right) (10 c^6 - c^4 + 52c^2 -36 ) = 0\tag{6}$$
Again, the first factor gives the target root, $\cos\theta=3/\sqrt{10}$ (as well as a newly-introduced extraneous root, $\cos\theta=-3/\sqrt{10}$). It's not clear that the second factor has no valid roots; indeed, Mathematica gives the positive solution $\cos\theta = 0.80501\ldots$ (amid otherwise negative or non-real candidates), but we can check that it doesn't satisfy $(1)$.  
A: If we start with this diagram:

we can deduce that:
$$
\overline{CE}=\sqrt{(k+1)^2+1}
\\
\overline{DE}=\frac{1}{k+1}\sqrt{(k+1)^2+1}
\\
\frac{\overline{DE}}{\overline{BC}}
=\frac{\frac{1}{k+1}\sqrt{(k+1)^2+1}}{k}
=\frac{\sqrt{(k+1)^2+1}}{k(k+1)}
=\frac{\sqrt{5}}{3\sqrt{2}}
\\
5k^2(k+1)^2=18(k+1)^2+18
\\
5k^4+10k^3-13k^2-36k-36=0
\\
(k-2)(5k^3+20k^2+27k+18)=0
$$
hence we have only one positive solution $k=2$.
Now we can deduce any segment length on the diagram from this solution.
