So there is DC: CP = Pb: Be.
Then 8/x=( 12-x)/y
Then y = (12-x) * x/8 =-(x-6) * (x-6)/8+4.5.
The relationship between y and x is y=-(x-6)*(x-6)/8+4.5.
When x=6, the maximum value of y is y=4.5.