So, for example, you are trying to find the minimum of :
Setting this equal to 0 gives or R = 0. (If all you care about is the variation of (theta) then ignore the R = 0 possibility, though it really can potentially affect the final answer.)
Use the second derivative test to decide if n is even or odd. The proof using the maximum is not much more complicated.