Suppose that $f(x) = x^TQx$, where $Q$ is $n\times n$ symmetric positive semidefinite matrix. Show that $f(x)$ is convex on the domain $\mathbb{R}^n$. Hint: it may be convenient to prove the following equivalent inequality: $$f(y+\alpha(x-y))-\alpha f(x)-(1-a)f(y)\le 0$$ for all $\alpha\in[0,1]$
UPDATE: I redid the calculations:
I did and tried to prove it's $\le0$ by the following:
$$(y^T + ax^T-ay^T)(Qy+aQx-aQy) - ax^TQx-(1-a)y^TQy = \\y^TQy + ay^TQx-ay^TQy+ax^TQy+a^2x^TQx-a^2x^TQy -ay^TQy -a^2y^TQx +a^2y^TQy- ax^TQx -(1-a)y^TQy = \\(1-2\alpha+\alpha^2-1+a)y^tQy + (\alpha^2-\alpha) x^tQx+(\alpha+\alpha-\alpha^2-\alpha^2)y^tQx =\\ (-2\alpha+\alpha^2+a)y^tQy+(\alpha^2-\alpha)x^tQx+(2\alpha + 2\alpha^2)y^tQx$$
But I still don't see why this should be less than $0$. We have that $y^tQy$ and $x^tQx$ are positive semidefinite matrices. However I don't know how to deal with the term $y^tQx$
Firstly, $a=\alpha$ (from the definition of a convex function).
Secondly, you still have a minor sign typo in the last line. It should be $$ (-2\alpha+\alpha^2+a)y^tQy+(\alpha^2-\alpha)x^tQx+(2\alpha \color{red}- 2\alpha^2)y^tQx. $$ With these corrections being done, the last line becomes $$ (\alpha^2-\alpha)y^tQy-2(\alpha^2-\alpha)y^tQx+(\alpha^2-\alpha)x^tQx=(\alpha^2-\alpha)\cdot (x-y)^tQ(x-y) $$ which is $\le 0$ since $(\alpha^2-\alpha)\le 0$ for $\alpha$ in the interval.