Really hope I'm right coz this took me forever. Also sorry for bad LaTeX.
Let
where
This is easily evaluated depending on the different cases:
If
or
, we have
, if
then
and
, and if
then
and
.
Case 1:
hence
for some constant
.
Evaluating the integral for
, we obtain that:
when
.
Case
or
.
(which follows from Case 1).
when
or
.
Case 3:
Let
By symmetry,
Let
By symmetry,
Therefore
, so
.
Subbing the values back in, we obtain
.
Case 4:
This can be done by the same method as case 3, and so
.
Hence, when
,
, and
otherwise.