Abbott's derivation of Fejer's kernel I am working on Abbott's understanding analysis 2nd edition, chapter 8.5 on Fourier series. The particular exercise I am having trouble with is the following, where we derive an expression for the Fejer kernel $F_{N}(\theta)$:

8.5.9) Use the previous identity [reproduced below] to show that


$
\frac{1/2 + D_{1}(\theta)+ D_{2}(\theta) + \cdots + D_{N}(\theta)}{N+1} = \frac{1}{2(N+1)}\left[ \frac{\sin\left((N+1)\frac{\theta}{2}\right)}{\sin\left(\frac{\theta}{2}\right)} \right]
$

Above, $D_{N}(\theta)$ is the Dirichlet kernel with
$
D_{N}(\theta)=
\begin{cases}
\frac{\sin\left((N+1/2)\theta\right)}{2\sin\left(\theta/2\right)}\quad\text{if }\theta\neq2n\pi\\
1/2+N\quad\text{if }\theta=2n\pi
\end{cases}
$
According to Abbott, one can complete this proof with the following facts:
Fact 1: a) $\cos(\alpha-\theta) = \cos(\alpha)\cos(\theta) + \sin(\alpha)\sin(\theta)$
b) $\sin(\alpha+\theta) = \sin(\alpha)\cos(\theta) + \cos(\alpha)\sin(\theta)$.
Fact 2: $\frac{1}{2} + \cos(\theta) + \cos(2\theta) + \cdots + \cos(N\theta) = \frac{\sin\left((N+1/2)\theta\right)}{2\sin\left(\theta/2\right)}$
Fact 3: $\sin(\theta) + \sin(2\theta) + \cdots + \sin(N\theta) = \frac{\sin\left(\frac{N\theta}{2}\right)\sin\left((N+1)\theta/2\right)}{\sin\left(\theta/2\right)}$
In the solution manual of the first edition, Abbott also uses the following two trigonometric identities:
Fact 4: $\sin(\theta)\cos(\theta) = (1/2)\sin(2\theta)$
Fact 5: $1 + \cos(\theta) = 2\cos^{2}(\theta/2)$.
Using these facts, I can arrive to the following solution (which Abbott does as well):
$
F_{N}(\theta)=\frac{1}{2(N+1)\sin^{2}(\theta/2)}\mathbf{B}
$,
where $\mathbf{B} = \frac{\sin^{2}(\theta/2)}{2} + \frac{\sin(\theta/2)\sin\left(N\theta + \frac{\theta}{2}\right)}{2} + \cos(\theta/2)\sin(N\theta/2)\sin((N+1)\theta/2)$
So we have to show that $\mathbf{B}=\sin^{2}((N+1)\theta/2)$.
We start by establishing the following identity, using fact 4:
$\sin^{2}((N+1)\theta/2)=\sin^{2}(N\theta/2)\cos^{2}(\theta/2) + \frac{\sin(N\theta)\sin(\theta)}{2} + \cos^{2}(N\theta/2)\sin^{2}(\theta/2)$
And I can manipulate $\mathbf{B}$ to the following equality
\begin{align}
  \mathbf{B} &= \frac{\sin^{2}(\theta/2)}{2}\\
  &+ \frac{\sin(\theta/2)}{2} [\cos(N\theta)\sin(\theta/2)+\sin(N\theta)\cos(\theta/2)]\\
  &+ \cos(\theta/2)\sin(N\theta/2)[\cos(N\theta/2)\sin(\theta/2) + \sin(N\theta/2)\cos(\theta/2)]
\end{align}
Abbott argues that one can turn the above equality into
$
\mathbf{B} = \frac{\sin^{2}(\theta/2)}{2}[1 + \cos(N\theta)] + \frac{\sin(N\theta)\sin(\theta)}{4} + \frac{\sin(N\theta)\sin(\theta)}{4} + \sin^{2}(N\theta/2)\cos^{2}(\theta/2)
$
From this last equation I can see how to get to the desired solution. However, using the facts above, and a list with several trigonometric identities I am able to arrive only to the following equality:
$
\mathbf{B} = \frac{\sin^{2}(\theta/2)}{2} + \frac{\sin(\theta/2)\sin(N\theta)\cos(\theta)}{2} + \frac{\sin(\theta/2)\cos(N\theta)\sin(\theta)}{2} + \frac{\sin(N\theta)\sin(\theta)}{4} + \sin^{2}(N\theta/2)\cos^{2}(\theta/2)
$
I would like to know what steps do I need to follow to go from my equation to Abbott's version.
On this site I have seen other ways to derive the Fejer kernel (see here, for example) but I want to do it with the knowledge Abbott has presented to us.
 A: I realized I had a typo on my notes. Starting from
\begin{align}
  \mathbf{B} &= \frac{\sin^{2}(\theta/2)}{2}\\
  &+ \frac{\sin(\theta/2)}{2} [\cos(N\theta)\sin(\theta/2)+\sin(N\theta)\cos(\theta/2)]\\
  &+ \cos(\theta/2)\sin(N\theta/2)[\cos(N\theta/2)\sin(\theta/2) + \sin(N\theta/2)\cos(\theta/2)],
\end{align}
we distribute the second and third lines of the equation to obtain
\begin{align}
  \mathbf{B} &= \frac{\sin^{2}(\theta/2)}{2}\\
  &+ \frac{\sin(\theta/2)}{2} \cos(N\theta)\sin(\theta/2) +
\frac{\sin(\theta/2)}{2}\sin(N\theta)\cos(\theta/2)\\
  &+ \cos(\theta/2)\sin(N\theta/2)\cos(N\theta/2)\sin(\theta/2) +
 \cos(\theta/2)\sin(N\theta/2)\sin(N\theta/2)\cos(\theta/2)\\
  &= \frac{\sin^{2}(\theta/2)}{2}\\
  &+ \frac{\sin^{2}(\theta/2)}{2} \cos(N\theta) +
\frac{\sin(\theta/2)}{2}\sin(N\theta)\cos(\theta/2)\\
  &+ \cos(\theta/2)\sin(N\theta/2)\cos(N\theta/2)\sin(\theta/2) +
 \cos^{2}(\theta/2)\sin^{2}(N\theta/2)\\
  &= \frac{\sin^{2}(\theta/2)}{2}[1+\cos(N\theta)]\\
  &+ \frac{\sin(\theta/2)}{2}\sin(N\theta)\cos(\theta/2)\\
  &+ \cos(\theta/2)\sin(N\theta/2)\cos(N\theta/2)\sin(\theta/2)\\
  &+ \cos^{2}(\theta/2)\sin^{2}(N\theta/2).\\
\end{align}
The first and last expressions are the same as in Abbott, so we can focus on the second and third expressions:
\begin{align}
  &\frac{\sin(\theta/2)}{2}\sin(N\theta)\cos(\theta/2) +
  \cos(\theta/2)\sin(N\theta/2)\cos(N\theta/2)\sin(\theta/2)\\
  &= \frac{\sin^{2}(\theta)\sin(N\theta)}{4} +
  \frac{\sin^{2}(\theta)\sin(N\theta)}{4}.\\
\end{align}
The first term follows from applying fact 4 to $\sin(\theta/2)$ and $\cos(\theta/2)$. The second follows from applying fact 4 to $\sin(\theta/2)$ and $\cos(\theta/2)$, and to $\sin(N\theta/2)$ and $\cos(N\theta/2)$.
Then we get the desired result.
