Macaulay duration for a coupon bond. Proof I am working on showing the following.


There is a coupon bond redeemable at par with annual coupon rate $r$ per year.  The yield to maturity is $i$.  The total number of coupons is $n$. Show that the Macaulay duration for this coupon bond is 
$$\frac{1+i}{i}-\frac{1+i+n(r-i)}{r[(1+i)^n-1]+i}$$


I understand the following.
To find the Macaulay Duration, we use the Present value of the bond, $P$ and the rate of change with respect to the yield rate $-\frac{d}{di}P$ and find the ratio, then multiply $1+i$.
So, letting $F$ be the face value and using some actuarial notation, I am thinking that 
$$\begin{align}
P &= Fr(v+v^2+ \cdots +v^n)+Fv^n \\
&=Fra_{\overline{n}\rceil i}+Fv^n\\
&=F(1+(r-i)a_{\overline{n}\rceil i})\\
\end{align}$$
I do not know which expression would be easier to use, but so far I have been trying to solve this using the last one.
Also, $-P'$ can be found as
$$\begin{align}
-P'&=Fr(v+2v^2+ \cdots +nv^n)+Fnv^n\\
&=F(r(Ia)_{\overline{n}\rceil i}+nv^n)\\
\end{align}$$
The Macaulay Duration can be found from 
$$D=\frac{F(r(Ia)_{\overline{n}\rceil i}+nv^n)}{F(1+(r-i)a_{\overline{n}\rceil i})}(1+i)$$
I do definitely see the bits and pieces in there, and as a matter of fact I was able to manipulate it so that the denominators are the same, but the numerator does not seem to match with my work.
For example, factoring out a $1 \over i$ on the given expression 
$$\frac{1}{i} \left( (1+i)-\frac{1+i+n(r-i)}{ra_{\overline{n}\rceil i}+1}\right)$$
and combining the two terms into one,
$$\frac{1}{i} \left( \frac{r\ddot{a}{_{\overline{n}\rceil}}+n(r-i)}{ra_{\overline{n}\rceil}+1}\right)$$
Since
$$(Ia)_{\overline{n}\rceil i}= \frac{\ddot{a}_{\overline{n}\rceil i}-nv^n}{i}$$
I have a feeling that I am on the right track, but I haven't gotten the right expression.  It's really driving me nuts!!
Can I have some help?
Thanks!
 A: As you found $$D=\frac{F(r(Ia)_{\overline{n}\rceil i}+nv^n)}{Fra_{\overline{n}\rceil i}+Fv^n}=\frac{r(Ia)_{\overline{n}\rceil i}+nv^n}{ra_{\overline{n}\rceil i}+v^n}$$
Substituting $(Ia)_{\overline{n}\rceil i}= \frac{\ddot{a}_{\overline{n}\rceil i}-nv^n}{i}$ and $a_{\overline{n}\rceil i}=\frac{1-v^n}{i}$ and $\ddot{a}_{\overline{n}\rceil i}=(1+i)a_{\overline{n}\rceil i}$
we have
$$
\begin{align}
D&=\frac{r\frac{\ddot{a}_{\overline{n}\rceil i}-nv^n}{i}+nv^n}{r\frac{1-v^n}{i}+v^n}=\frac{r\ddot{a}_{\overline{n}\rceil i}-r\,nv^n+i\,nv^n}{r-rv^n+iv^n}=\frac{r\ddot{a}_{\overline{n}\rceil i}-r\,nv^n+i\,nv^n}{r-rv^n+iv^n}\\
&=\frac{r(1+i){a}_{\overline{n}\rceil i}+(i-r)\,nv^n}{r+(i-r)v^n}=\frac{r(1+i)\frac{1-v^n}{i}+(i-r)\,nv^n}{\color{red}{v^n}\{r[(1+i)^n-1]+i\}}\\
&=\frac{\color{red}{v^n}\left\{r\frac{1+i}{i}(v^{-n}-1)+(i-r)n\right\}}{\color{red}{v^n}\{r[(1+i)^n-1]+i\}}
=\frac{r\frac{1+i}{i}[(1+i)^n-1]+(i-r)n}{r[(1+i)^n-1]+i}\\
&=\frac{r\frac{1+i}{i}[(1+i)^n-1]\color{red}{+\frac{1+i}{i}i-\frac{1+i}{i}i}+(i-r)n}{r[(1+i)^n-1]+i}\\
&=\frac{\color{red}{\frac{1+i}{i}}\{r[(1+i)^n-1]+\color{red}{i}\}-\color{red}{\frac{1+i}{i}i}+(i-r)n}{r[(1+i)^n-1]+i}\\
&=\color{red}{\frac{1+i}{i}}+\frac{\color{red}{-\frac{1+i}{i}i}+(i-r)n}{r[(1+i)^n-1]+i}
\end{align}
$$
that is $$\color{blue}{D=\frac{1+i}{i}-\frac{1+i+(r-i)n}{r[(1+i)^n-1]+i}}$$
