If $g(x) = \max(y^2-xy)(0 \leq y\leq 1)\;,$ Then minimum value of $g(x)$ If $g(x) = \max\limits_{0 \leq y\leq 1}(y^2-xy)$, then minimum value of $g(x)$
$\bf{My\; try::}$ We can write  $\displaystyle f(y) = y^2-xy = y^2-xy+\frac{x^2}{4}-\frac{x^2}{4} = \left(y-\frac{x}{2}\right)^2-\frac{x^2}{4}$
Now when $y=0\;,$ Then expression $f(0) = y^2-xy=0$
Now when $y=1\;,$ Then expression $f(1) = (1-x).$
So $\displaystyle g(x) = \max\left(f(0)\;,f(1),f\left(\frac{x}{2}\right)\right)$.
Now How can i solve after that, Help me
Thanks
 A: It seems like you picked $y=x/2$ as a possible maximum value of $\left(y-\frac{x}{2}\right)^2-\frac{x^2}{4}$ instead of a possible minimum. You're almost there. Here's a full argument:
To evaluate $\max\limits_{0 \leq y\leq 1}(y^2-xy)$, you need to first find its stationary point by taking $f(y) = y^2-xy$ and solving $df/dy = 0$ (there's only one, since $f$ is a parabola): $2y - x = 0 \Rightarrow y = x/2$. That might be a local maximum or a local minimum, so to calculate the global maximum for $y\in [0,1]$, you need to compare this value with the extremities $f(0)$ and $f(1)$.
$$\begin{align}
g(x) &= \max\left(f(0)\;,f(1),f\left(\frac{x}{2}\right)\right)\\
 &= \max\left(0\;,1-x,\frac{-x^2}{4}\right)\\
 &= \max\left(0\;,1-x\right)\\
 &= \begin{cases}
0 & x>1 \\
1-x & x\le 1
\end{cases}
\end{align}$$
Note that $g(x)\ge0$ if $x\le1$. So the minimum value of $g(x)$ is $0$.

MATLAB code to check the answer (for $-1000<x<1000$):
N = 1000;
X = 1000;
M = X*1000;
y = 0:1/N:1-1/N;
x = -X:2*X/M:X-2*X/M;
g=zeros(M,1);
for k=1:M
    g(k) = max(y.^2-x(k)*y);
end
plot(x,g);
min(g)

Plot:

Output:
ans =

     0

