ok I don't understand how this was done

inergral(y2 and y1)
pgywdy = 1/2 pgw(y2^2 - Y1^2)

ok it's been a while sense calc
I rember you add one to the power of the term that was a dervitative and divide by that power hence (1/2)(y2^2 - Y1^2)

but what happened to the y term after the g term???

please don't be mad

You need to review your calculus.

pdw ydy is the operand of the integral.
INT pdw ydy= pdw int ydy= pdwy^2/2 evaluated over the limits.