Capital Gains and Dividends

motivated by a discussion on bogleheads.
Okay, here's the problem:
 We start with a portfolio worth $A_{0}.
 Each year we get dividends.
 The portfolio grows at a certain annual rate ... and the dividend amounts increase at a certain annual rate.
 If the dividends are taxed each year at some dividendrate ... and the portfolio is taxed after n years at a capitalgains rate, what's our portfolio worth at year n, after taxes?
We asume:
A_{0} = initial portfolio.
g = annual growth factor for the assets in the portfolio (so $1 grows to $g in 1 year).
d = annual dividend.
t = dividend tax rate.
D = d (1t) = the first aftertax dividend (reinvested).
x = annual growth factor for the dividends (so a $1 dividend in one year would be $x the following year).
T = capital gains tax rate.
Consider only the growth of the original portfolio.
At the end of k years it'd be worth:
[0] g^{k} A_{0} ... since it grows by a factor g each year.
>Where's the dividends?
Patience. We'll get to them soon enuff.
All of the gain after n years, namely [g^{n} A_{0}  A_{0}] = [g^{n}  1] A_{0}, is taxable at the capital gains rate T, leaving:
[1] P_{1} = g^{n}A_{0}  T [g^{n}  1] A_{0}
= { (1T) g^{n} + T } A_{0} aftertax balance.
Now consider the dividends.
The first dividend, D, has a final worth of g^{n1}D and a $gain of (g^{n1}  1) D ... being invested for n1 years.
The second dividend, xD, has a final worth of g^{n2}xD and a $gain of (g^{n2}  1) xD ... being invested for n2 years.
The third dividend, x^{2}D, has a final worth of g^{n3}x^{2}D and a $gain of (g^{n3}  1) x^{2}D ... being invested for n3 years.
...
The nexttolast dividend, x^{n2} D, has a final worth of g x^{n2}D and a $gain of (g  1) x^{n2} D ... being invested for 1 year.
The last dividend, x^{n1} D, has a final worth of x^{n1}D and a $gain of 0 ... being invested for 0 years.
>You're considering the dividends as being in a separate investment account?
Uh ... yes. For purposes of the calculations.
The total dividend gain is then the sum of the above $gains, namely:
D { (g^{n1}1) + (g^{n2}1) x + (g^{n3}  1) x^{2} + ... + (g1) x^{n2}}
= D {g^{n1} + g^{n2}x + g^{n3}x^{2} + ... + gx^{n2} + x^{n1}
 (1 + x + x^{2} + ... + x^{n2} + x^{n1})}.
Or, summing the series we get the total $gain in our "dividend account as:
D {(g^{n}  x^{n}) / (g  x)  (x^{n}  1) / (x  1) }
The tax on this total $gain (at the capitalgains rate T) is:
T D {(g^{n}  x^{n}) / (g  x)  (x^{n}  1) / (x  1) }.
Similarly, the final value of the dividend portfolio is the sum of all the final dividend values (after umpteen years of investing), namely:
D {(g^{n}  x^{n}) / (g  x) }
>Huh?
Just stare intently at what we did above. The final $value of each dividend is given there. We just add 'em all up.
Subtracting, from the final portfolio generated by the dividends, the capitalgains tax (on the dividend gains) leaves:
[2] P_{2} =
(1  T) D (g^{n}  x^{n}) / (g  x) + T (x^{n}  1) / (x  1).
Finally (!) the aftertax portfolio is then P_{1} + P_{2}, namely: taDUM !
[A] Final aftertax Portfolio =
{ (1T) g^{n} + T } A_{0} + (1  T) D (g^{n}  x^{n}) / (g  x) + T D (x^{n}  1) / (x  1) 
>I think you're in trouble if x = 1 and ...
Meaning the dividends don't increase. Yes, but in that case:
If the dividends are constant, then x = 1 and the above reduces to:
(1  T) [g^{n}  1] A_{0} + (1  T) D (g^{n}  1) / (g  1) + n R D
If the dividend increases equal the return on the assets, that is x = g, then the above reduces to:
(1  T) [g^{n}  1] A_{0} + (1  T) D n g^{n1} + R D (g^{n}  1) / (g  1)
>That's it?
Well, yes ... except, maybe, for a chart:
>What! No spreadsheet?
Uh ... well, there is one. Click here to download.
>So all the capital gains are taxed at the end of year n. What if ... ?
Some of these gains are taxed each year? Okay, let's condsider that.
>And what if there are additional investments each year?
Okay, let's do that, too.
Capital Gains and Dividends ... again

Here we'll add an additional investment $B each year and capitalgainstax a fraction f of the portfolio each year.
In the above stuff, the portfolio balance at the end of year n is the sum of two balances: the original portfolio P_{1} and the dividend account P_{2}.
Let's consider each, at the end of year k.
Consider only the growth of the original portfolio.
[3a] P_{1}(k) = g P_{1}(k1)
... applying the annual gain factor to the previous year's balance.
Note that: P_{1}(0) = A_{0}.
Now apply a capital gains tax T to a fraction f of the annual gain.
In other words, we'll apply the tax R to the fraction:
f {P_{1}(k)  P_{1}(k1)}
= f (g  1) P_{1}(k1) .
That'd leave the aftertax balance as:
[3b] P_{1}(k) = g P_{1}(k1)  T f (g  1) P_{1}(k1)
= {g  T f (g  1)}P_{1}(k1)
... applying the annual gain then subtracting the capital gains tax on a fraction of the $gain.
Note that this is similar to equation [0] above, but with g replaced by:
G = g  T f (g  1).
>So it's like ... uh, we reduce the annual gain factor to incorporate capital gains, right?
Right, but just to a fraction f of the capital $gains. If f = 0, we're back to G = g again.
Now consider the annual additions.
Now we add our aftertax dividend and the additional (constant) investment of $B and get:
[3c] P_{1}(k) = G P_{1}(k1) + x^{k1}D + B.
>That aftertax dividend is after the dividend tax?
Yes, and at year k it's increased by a factor x^{k1} from the initial dividend D, received at the end of year 1.
After n years our "partiallytaxed" balance would be:
[3d] P_{1}(n)
= G^{n} A_{0} + {(G^{n}  x^{n}) / (G  x) } D + {(G^{n}  1)/(G  1)}B
... where G = g  T f (g  1).
The first two terms are what we got before, but with the taxreduced gain factor G (rather than g).
>What about all the taxes that wasn't paid?
Patience.
After subtracting the unpaid taxes, our portfolio will look like: P_{1}(n)  T(untaxed gains)
... so now we calculate those (untaxed gains).
Note that, each year, we've subtracted a percentage f of the capital gains tax.
The resultant portfolios then had that taxreduced gain G factor.
After n years of applying that taxreduced gain G factor:
>>>> the initial portfolio A_{0} becomes G^{n} A_{0} with a $gain of (G^{n}  1) A_{0}.
After n years:
>>>> the annually increased dividends D, xD, x^{2}D ... x^{n1}D have a $gain of
D{(G^{n}  x^{n}) / (G  x)  (x^{n}  1) / (x  1)}
... as we got earlier, but using the taxreduced gain factor G.
After n years:
>>>> the annual investments of $B have a $gain of
{(G^{n1}  1)B + (G^{n2}  1)B + ... + (G  1)B + (11)B}
= {(G^{n}  1) / (G  1)  n}B,
Note that the last investment has no $gain at all
... but we left it in 'cause it's easier to sum the series.
Adding the three $gains and applying the capital gains tax T and subtracting from our portfolio from [3d] we get: taDUM !
>Is taDUM really necessary?
Final aftertax Portfolio
= [
G^{n} A_{0} + {(G^{n}  x^{n}) / (G  x) } D + {(G^{n}  1)/(G  1)}B]
 T[(G^{n}  1) A_{0}
+ D{(G^{n}  x^{n}) / (G  x)  (x^{n}  1) / (x  1)}
+ {(G^{n}  1) / (G  1)  n}B]
Or, (perhaps) more simply:
[B] Final aftertax Portfolio =
{(1  T) G^{n} + T} A_{0}
+ (1  T) D (G^{n}  x^{n}) / (G  x) + T D (x^{n}  1) / (x  1)
+ {(1  T)(G^{n}  1) / (G  1) + nT}B
where:
A_{0} = initial portfolio
g = annual growth factor for the assets in the portfolio (so $1 grows to $g in 1 year)
d = annual dividend
t = dividend tax rate
D = d (1t) = the first aftertax dividend (reinvested)
x = annual growth factor for the dividends (so a $1 dividend in one year would be $x the following year)
T = capital gains tax rate
f = fraction of annual portfolio that is capitalgaintaxed
B = additional annual investment
G = g  T f (g  1) = a tax reduced annual gain factor

>Mamma mia! Do I have to memorize that for the final exam?
Note that, if f = 0 (so nothing is capitalgainstaxed until year n), then G = g.
Further, if B = 0 (so no new investments are made), then [B] reduces to [A].
>And you still have that problem with x = 1 or x = G.
Uh ... yes.
We used a magic formula for summing a series: G^{n1} + G^{n2}x + G^{n3}x^{2} + ... + G x^{n2} + x^{n1} = (G^{n}  x^{n}) / (G  x).
However, if x = G then we'd get 0 / 0 ... but then the series is easy to sum:
G^{n1} + G^{n2}G + G^{n3}G^{2} + ... + G g^{n2} + G^{n1} = n G^{n1}.
>So where's the spreadsheet?
Oh ... yeah. It looks something like this:
Just click on the picture to download.
>What's all them sliding thingies?
In case you're too lazy to type in values, you can drag the slider with your mouse to change the values of some parameters.
You can also, of course, type in your own values.
>And all this stuff really works?
You kidding? I offer this moneyback guarantee and ..
>zzzZZZ
