How to get the maximum value of the sum in two sides in two right triangles? The problem is as follows:

The figure from below shows two triangles intersected on point $E$. Assume $AE=3\,m$ and $ED=1\,m$. Find the maximum value of $AB+EC$


The given choices in my book are as follows:
$\begin{array}{ll}
1.&\sqrt{10}\,m\\
2.&\4\,m\\
3.&\sqrt{5}\,m\\
4.&\4\,m\\
\end{array}$
The official solution for this problem according to my book is shown below:
Let $M=AB+EC$
Notice on the figure:

$AB=3\sin x$
and $EC=\cos x$
$M=3\sin x+\cos x$
$M=\sqrt{10}\left(\frac{3}{\sqrt{10}}\sin x+\frac{1}{\sqrt{10}}\cos x\right)$
$\tan \alpha =\frac{1}{3}$
$M=\sqrt{10}\left(\sin (x+\alpha)\right)$
Also notice that $x$ and $\alpha$ are acute angles.
Therefore:
$0<x+\alpha<\pi$
$\sin (x+\alpha)\leq 1$
Thus the maximum $M$ is $\sqrt{10}$.
There is where it ends the official solution.
But I am confused, where exactly is that alpha that is being talking about?, how did the author came up with the idea of $\sqrt{10}$ and the use of $\frac{1}{3}$.
Could someone please explain me, the logic that the author used and offer an alternate solution, perhaps easier to understand and less to guess what it was meant?.
I appreciate a step by step solution so I can understand.
 A: Any expression in the form $a\sin x+b\cos x$ can be written as $\sqrt{a^2+b^2}\left(\frac{a}{\sqrt{a^2+b^2}}\sin x+\frac{b}{\sqrt{a^2+b^2}}\cos x\right)$. Note that $\left(\frac{a}{\sqrt{a^2+b^2}}\right)^2+\left(\frac{b}{\sqrt{a^2+b^2}}\right)^2=1$ which means that we can interpret these two expressions as cosine and sine of some angle $\alpha$. Think of a right triangle with legs $3$ and $1$ and you will understand what $\alpha$ is.
A: First things first, the way I learned this is a little different from how your textbook seems to have done it - I was taught to incorporate the cosine function while they are using the sine function.
The first steps of the solution are simple enough. Since we are scaling $AE$ and $ED$ by $m$, every segment will have a factor of $m$ in it. For this reason, when we take $\sin{x}=\frac{AB}{3m}$ and multiply both sides by $3m$, we get $3m\sin{x}=AB'm$, where $AB'=\frac{AB}{m}$. Simplifying on both sides, we get $3\sin{x}=AB'$. The logic is similar for finding $\cos{x}=EC'$ .
Now we begin to investigate $M=AB+EC=\cos{x}+3\sin{x}$. Consider the point $(1,3)$, with the 1 coming from the coefficient of our cosine function, and the 3 from the coefficient of our sine function. This point can be rewritten in polar form. If you have not learned this yet, the polar form of a point describes its notation not in terms of distance from the x and y-axes, but in terms of its distance from the origin and the angle between the line connecting the point to the origin and the x-axis. So, for our point $(1,3)$, it is a trivial matter to calculate its distance from the origin. It is simply $\sqrt{10}$. As for the angle, which we will call $\alpha$, we can calculate it by remembering the definition of the tangent function and saying $\tan{\alpha}=3$, or $\alpha=\arctan{3}$.
Here is the clever part. By definition, $\cos{\alpha}\sqrt{10}=1$ and $\sin{\alpha}\sqrt{10}=3$, and thus $\cos{\alpha}=\frac{1}{\sqrt{10}}$ and $\sin{\alpha}=\frac{3}{\sqrt{10}}$. We can rewrite our function $M$ as $M=\sqrt{10}(\frac{1}{\sqrt{10}}\cos{x}+\frac{3}{\sqrt{10}}\sin{x})$. This is the exact same as $M=\sqrt{10}(\cos{\alpha}\cos{x}+\sin{\alpha}\sin{x})$. This should look incredibly familiar, because after applying the difference of angle theorem for cosine, what we have now is $M=\sqrt{10}(\cos{(x-\alpha)})$.
Now, here's the kicker. What $\alpha$ is actually equal to does not matter particularly much in this problem, since we are trying to maximize $M$. We know that for any argument, the maximum value of $\cos{x}$ is 1. And thus, the maximum value of $\sqrt{10}(\cos{x})$ is $\sqrt{10}$. After factoring our $m$ that we took out earlier back in, we see that the maximum value of $AB+EC=\sqrt{10}m$.
A: Let $AM=CD$ and $AN=DE$
Since $\angle AMN=\angle CDE$,(cyclic quadrilateral),  $\triangle AMN \cong \triangle DCE$, then, $AN=ED=1$
Let $AB=x$, and, $EC=MN=y$
Since $\triangle ABE \sim \triangle AMN$, (AAA Similarity), $BE=3y$
FIRST ALTERNATIVE SOLUTION:
$x^2+9y^2=9$, in $\triangle ABE$
$x=\sqrt{9-9y^2}$
To find max$(x+y)$
$f(y)=\sqrt{9-9y^2}+y$
$f'(y)=\frac{-9y}{\sqrt{9-9y^2}}+1=0$
There is a maximum when $y=\frac{1}{\sqrt{10}}$ ,and, $x=\frac{9}{\sqrt{10}}$
$\text{max}(AB+EC)=\text{max}(x+y)=\frac{10}{\sqrt{10}}=\sqrt{10}$
SECOND ALTERNATIVE SOLUTION:
$x^2+9y^2=9$, in $\triangle ABE$
To find max$(x+y)$
Applying Cauchy-Schwarz inequality
$$(x+y)^2=(x+\frac{1}{3}\times 3y)^2\leq (1^2+(\frac{1}{3})^2)\times (x^2+(3y)^2)=$$
$$=(1+\frac{1}{9})\times (x^2+9y^2)=$$
$$=(1+\frac{1}{9})\times 9=10$$
$$x+y\leq\sqrt{10}$$
