Proving Convexity of MSE I was going through notes on convexity and it is mentioned as following
for any $\lambda ∈ [0,1]$ and
$w, w′$
$$L(\lambda w + (1 − \lambda)w′) − (\lambda L(w) + (1 − \lambda)L(w′)) ≤ 0$$
where $$L(w) = \frac{1}{2N}|| y - Xw||^2_2$$
The solution given is LHS = $$-\frac{1}{2N}\lambda(1-\lambda)||X(w-w')||^2_2$$
Whereas when I try to solve it myself by expanding the squares I keep getting
$$-\frac{1}{N}\lambda(1-\lambda)X^2ww'$$
Edit: I know what I did wrong and why my solution is wrong but I still cant get the correct answer.
Can anyone please explain what am i missing? How do I solve this?
 A: Let $\mathcal{H}$ be a real Hilbert space with inner product $\langle \cdot \, | \, \cdot \rangle,$ and let $x$ and $y$ be in $\mathcal{H}.$ Then, for any $\alpha \in \mathbb{R},$
$$ \| \alpha x + (1 - \alpha) y \|^2 + \alpha (1 - \alpha) \| x - y \|^2 = \alpha \| x \|^2 + (1 - \alpha) \| y \|^2. $$
Additionally, since
$$ (\forall \alpha \in \,]0,1[) ~~ \alpha (1 - \alpha) \| x - y \|^2 \geq 0,$$
we have,
\begin{align*}
(\forall \alpha \in \,]0,1[) ~~ \| \alpha x + (1 - \alpha) y \|^2 &= \alpha \| x \|^2 + (1 - \alpha) \| y \|^2 - \alpha (1 - \alpha) \| x - y \|^2 \\
&\leq \alpha \| x \|^2 + (1 - \alpha) \| y \|^2,
\end{align*}
so the function $\|\cdot \|^2$ is convex.
Indeed, we have

*

*$\| \alpha x + (1 - \alpha) y \|^2 = \alpha^2 \| x \|^2 + \| y \|^2 + \alpha^2 \| y \|^2 - 2 \alpha \| y \|^2 + 2 \alpha (1 - \alpha) \langle x \, | \, y \rangle;$

*$\alpha (1 - \alpha) \| x - y \|^2 = \alpha \| x \|^2 - \alpha^2 \| x \|^2 + \alpha \| y \|^2 - \alpha^2 \| y \|^2 - 2 \alpha (1 - \alpha) \langle x \, | \, y \rangle. $
Summing the above two quantities together yields the desired result. Now, let $\mathcal{K}$ be a real Hilbert space, fix $y \in \mathcal{H},$ let $X : \mathcal{K} \rightarrow \mathcal{H}$ be linear and continuous, and define
$$ T : \mathcal{K} \rightarrow \mathcal{H} : w \mapsto y - X w. $$
Then $L = \frac{1}{2N} f \circ T,$ where $f = \| \cdot \|^2.$ Since $T$ is affine and $f$ is convex, one can conclude that $L$ is convex as it is the composition of a convex function and an affine function (show that this is true).
Recall that a function $G: \mathcal{K} \rightarrow \mathcal{H}$ is affine if
$$ (\forall x \in \mathcal{K})(\forall y \in \mathcal{K})(\forall \lambda \in \mathbb{R}) ~~ G (\lambda x + (1 - \lambda)y) = \lambda G(x) + (1 - \lambda) G(y). $$
