Answer
a) $ \frac{mg}{2}(Lsin\theta-w(1-cos\theta))$
b) $tan^{-1}(\frac{L}{w})$
c) Unstable
Work Step by Step
a) We know that the maximum value of the function is $\frac{mg}{2}$, for this multiplied by the height is the potential energy when the block is upright. We know that the zero potential energy is defined as the center of mass when the box is on its edge. Thus, we find:
$=\frac{mg}{2}(L-w)$
However, we still need to adjust this function. We know that energy is maximized when $\theta=90^{\circ}$, and we know that it is equal to $w$ when the angle is 0 degrees. Thus, we find:
$ U = \frac{mg}{2}(Lsin\theta-w(1-cos\theta))$
b) Taking the derivative and setting it equal to zero gives:
$ 0 = \frac{mg}{2}(Lcos\theta-wsin\theta)$
$ 0 =(Lcos\theta-wsin\theta)$
$\frac{w}{L}tan\theta = 1$
$\theta = tan^{-1}(\frac{L}{w})$
c) Taking the second derivative gives:
$ \frac{dU^2}{dt^2} =(-Lsin\theta-wcos\theta)$
This will always be negative, so the equilibrium is unstable.