I was tasked with finding the extremum of $z=xy$ under the constraint $x+y=1$, here is what I did: $$z=xy$$ $$x+y=1$$ from the second line we get $y=x-1$ and we substitute that back in the first equation: $$z=x(1-x)= x-x^2$$ $$z'(x) = 1-2x$$ next $$z'(x) = 0$$ $$<=> $$ $$0 = 1-2x$$ $$x=0.5$$ $$=>y=0.5$$ $$=>$$ $$(0.5,0.5)$$ suspected as extrema. $$z''(x)= -2$$ $$z''(0.5)= -2<0 $$ hence $$(0.5,0.5)$$ local maxima. $$=> z_{max} = z(0.5,0.5) = 0.5 * 0.5 = 0.25 $$
Is this ok?

hint: $(x-y)^2 \geq 0 \implies xy \leq \dfrac{(x+y)^2}{4}$. Can you take it from here?