# Prove: $\forall a\in\mathbb R$, $\max\{y=x(a-x):x\}=\frac{a}{2}$

I'm trying to prove that $$\forall a\in\mathbb R$$, the value of $$x$$ that gives the maximum value of $$y=x(a-x)$$ is $$x=\frac{a}{2}$$.

I'm told that I must use this inequality to prove this: $$\forall x,y\in\mathbb R$$, $$xy\leq(\frac{x+y}{2})^2$$.

I know how to do this with basic calculus by finding $$\frac{dy}{dx}=a-2x$$ then $$\frac{dy}{dx}=0$$ when $$x=\frac{a}{2}$$.

I have no clue how to even start with using the above inequality to prove this though... Any help would be greatly appreciated!

• Alternatively you can complete the square (which is also a proof of the inequality that they told you to use) $x(a-x)=a^2/4-(x-a/2)^2$. Jan 26, 2020 at 23:03

## 1 Answer

Nevermind, figured it out minutes after posting this.

\begin{align*} x(a-x)&\leq(\frac{x+a-x}{2})^2\\ y&\leq(\frac{a}{2})^2\\ \end{align*} Hence the max of $$y$$ is $$\frac{a^2}{4}$$. Solving for $$x$$: \begin{align*} \frac{a^2}{4}&=ax-x^2\\ x^2-ax+\frac{a^2}{4}&=0 \end{align*} This has a double root when $$x=\frac{a}{2}$$.