You shouldn't have to square them. I think there's an easier way.
When you maximize or minimize a distance, there is a trick based on the observation that the distance and the square of the distance have their max's and min's at the same point.
We can use this trick here. Why not?.
\(\displaystyle x+y=8\)....[1]
\(\displaystyle P=xy\).....[2]
Solve [1] for y, sub into [2], differentiate, set to 0 and solve for x.