I tried to solve the following equations:
$$-w^2 + 11w -11/2 = 10(w-P)-(w-P)^2$$
First, I got rid of the brackets and ended up with the following equation:
$$w-11/2 = 2wP-10P-P^2$$
And now I am stuck. How do I solve this equation for P as a function of w? The right answer should be this:
$$ P(w)= \sqrt{ (11/2-w)^2+1/4}-(5-w)$$
Factorizing $$-w^2+11w-\frac{11}{2}-10(w-P)+(w-P)^2=0$$ we get
$$\frac{1}{2} \left(2 P^2-4 P w+20 P+2 w-11\right)=0$$ solving this for $$P$$ we get $$P_{1,2}=\frac{1}{2}(-10+2w\pm\sqrt{2}\sqrt{61-2w+2w^2})$$