Solution :

Note that  since  for all .

Therefore, .

Thus, for odd values of ,

.

For even values of ,