Tax analysis (math)

🇺🇸

 contains supporting analysis for various tax situations.

Taxable account performance
$$ \begin{align} t & = \text{time} \\ V(t) & = \text{investment value at time t} \\ V(0) & = \text{initial investment value} \\ B(t) & = \text{investment basis at time t} \\ B(0) & = \text{initial investment basis} \\ V_{at}(t) & = \text{investment value at time t} \\ r & = \text{overall rate of return} \\ y & = \text{investment yield} \\ tr_{div} & = \text{tax rate on dividends} \\ tr_{cg} & = \text{tax rate on capital gains} \\ \end{align} $$

For simplicity and clarity, this derivation will assume continuous compounding, but the formula may be modified for period compounding as desired. Continuous compounding formulas use exponentials of base e $$\approx$$ 2.71828. The value of the investment at any future time t can be written as follows:

$$ \begin{align} V(t) & = V(0) \cdot e^{(r-y \cdot tr_{div})t} \end{align} $$

Calculating the basis at any time t requires integration. The rate of change of the basis at any time t is equal to the value at t, multiplied by the yield, multiplied by (1 - $$tr_{div}$$). The product of $$V(t) \cdot y \cdot tr_{div}$$ is the rate of loss to dividend taxes, and the remainder is added to the cost basis:

$$ \begin{align} \frac{dB(t)}{dt} & = V(t) \cdot y \cdot (1-tr_{div}) = V(0) \cdot y \cdot (1-tr_{div}) \cdot e^{(r-y \cdot tr_{div})t} \end{align} $$

Integrating this formula (using a Computer Algebra System) from 0 to t and setting $$B(0) = V(0)$$ gives:

$$ \begin{align} B(t) & = \int_{0}^{t}\ V(0) \cdot y \cdot (1-tr_{div}) \cdot e^{(r-y \cdot tr_{div})\tau}d\tau = V(0) + \left ( \frac{V(0) \cdot y \cdot (1-tr_{div})}{r-y \cdot tr_{div}} \right ) \left ( e^{(r-y \cdot tr_{div})t}-1 \right ) \end{align} $$

Finally, the after-tax value after the investment is sold is given by:

$$ \begin{align} V_{at}(t) & = V(t) - \left ( V(t) - B(t) \right ) \cdot tr_{cg} \end{align} $$

Effective capital gains rate
Rather than calculating an explicit basis, the equation is somewhat simpler when an effective capital gains tax rate, defined as the capital gains tax rate if the basis were equal to the original investment. As a shorthand, define:

$$ \begin{align} A & = \frac{V(t)}{V(0)} = e^{(r-y \cdot tr_{div})t} \end{align} $$

...with continuous compounding, or:

$$ \begin{align} A & = \frac{V(t)}{V(0)} = (1 + r-y \cdot tr_{div})^{t} \end{align} $$

...with periodic compounding. The effective capital gains tax rate is the value that satisfies this equation:

$$ \begin{align} \left ( V(0) \cdot A - B(t) \right ) \cdot tr_{cg} & = \left ( V(0) \cdot A - V(0) \right ) \cdot {tr_{cg}}^{*} \end{align} $$

Rearranging and plugging in $$B(t)$$:

$$ \begin{align} {tr_{cg}}^{*} & = tr_{cg} \cdot \left ( \frac{V(0) \cdot A - B(t)}{V(0) \cdot A - V(0)} \right ) = tr_{cg} \cdot \left ( \frac{V(0) \cdot A - \left ( V(0) + \left ( \frac{V(0) \cdot y \cdot (1-tr_{div})}{r-y \cdot tr_{div}} \right ) \left ( A-1 \right ) \right )}{V(0) \cdot A - V(0)} \right ) \end{align} $$

Canceling $$V(0)$$:

$$ \begin{align} {tr_{cg}}^{*} & = tr_{cg} \cdot \left ( \frac{A - 1 - \left ( \frac{y \cdot (1-tr_{div})}{r-y \cdot tr_{div}} \right ) \left ( A-1 \right ) }{A - 1} \right ) \end{align} $$

Canceling $$(A-1)$$:

$$ \begin{align} {tr_{cg}}^{*} & = tr_{cg} \cdot \left ( 1 - \left ( \frac{y \cdot (1-tr_{div})}{r-y \cdot tr_{div}} \right ) \right ) \end{align} $$

Simplifying:

$$ \begin{align} {tr_{cg}}^{*} & = tr_{cg} \cdot \left ( \left ( \frac{r-y \cdot tr_{div}}{r-y \cdot tr_{div}} \right ) - \left ( \frac{y \cdot (1-tr_{div})}{r-y \cdot tr_{div}} \right ) \right ) = tr_{cg} \cdot \left ( \frac{r-y \cdot tr_{div} - y \cdot (1 - tr_{div})}{r-y \cdot tr_{div}} \right ) \end{align} $$

Further simplifying:

$$ \begin{align} {tr_{cg}}^{*} & = tr_{cg} \cdot \left ( \frac{r-y}{r-y \cdot tr_{div}} \right ) \end{align} $$

Using this value, the after-tax value of the investment is:

$$ \begin{align} V_{at}(t) & = V(t) - \left ( V(t) - V(0) \right ) \cdot {tr_{cg}}^{*} \end{align} $$

Derivation of tax rate boundaries for Social Security taxation
Variables are defined as follows:

$$ \begin{align} SS & = \text{Social Security income} \\ OI & = \text{other income} \\ BT & = \text{bracket threshold} \\ SD & = \text{standard deduction} \\ LB & = \text{lower base} \\ UB & = \text{upper base} \\ RI & = \text{relevant income} = 0.5 \cdot SS + OI \\ \end{align} $$

Point above which 40.7% marginal rate is possible
The point above which 40.7% marginal tax rates is possible is when total taxable income is at the 22% tax bracket threshold and the maximum 85% of Social Security benefits are taxable. It is the combination of $$SS$$ and $$OI$$ that satisfies these two equations:

$$0.85 \cdot SS + OI - SD = BT$$

$$0.5 \cdot (UB - LB) + 0.85 \cdot (RI - UB) = 0.85 \cdot SS$$

Rearranging the first equation to solve for OI gives:

$$OI = BT + SD - 0.85 \cdot SS$$

Save this result for later substitution. Substitute the definition of relevant income into the second equation:

$$0.5 \cdot (UB - LB) + 0.85 \cdot (OI + 0.5 \cdot SS - UB) = 0.85 \cdot SS$$

Substitute in the formula for OI from the rearranged first equation:

$$0.5 \cdot (UB - LB) + 0.85 \cdot \left ([BT + SD - 0.85 \cdot SS] + 0.5 \cdot SS - UB \right) = 0.85 \cdot SS$$

Collecting the SS terms from the left hand side:

$$0.5 \cdot (UB - LB) + 0.85 \cdot (BT + SD - UB) + 0.85 \cdot (0.5 \cdot SS - 0.85 \cdot SS) = 0.85 \cdot SS$$

Simplifying the SS terms on the left hand side:

$$0.5 \cdot (UB - LB) + 0.85 \cdot (BT + SD - UB) - 0.2975 \cdot SS = 0.85 \cdot SS$$

Solving for SS and labeling this value SS* gives:

$$SS^{*} = \dfrac{0.5 \cdot (UB - LB) + 0.85 \cdot (BT + SD - UB)}{1.1475}$$

Recalling the equation above for OI in terms of SS, and labeling this value OI* gives:

$$OI^{*} = BT + SD - 0.85 \cdot SS^{*}$$

22.2% bump begins
For single filers, the 22.2% bump begins in the middle of the 12% bracket when Social Security taxation begins to be taxed at an 85% marginal rate. This occurs when:

$$0.5 \cdot SS + OI = UB$$

Substituting $34,000 for UB gives:

$$OI = $34,000 - 0.5 \cdot SS$$

For married filers, the 22.2% bump begins at the boundary between the 10% and 12% brackets. The line is defined by the solution to these equations:

$$0.5 \cdot (UB - LB) + 0.85 \cdot (RI - UB) = p \cdot SS$$

$$OI + p \cdot SS = BT + SD$$

where $$p$$ is the percentage of Social Security income that is taxable. $$p$$ is an unknown variable, but with two equations and three unknowns it should be possible eliminate $$p$$ through substitution. Solving for $$p$$ in the second equation gives:

$$p = \dfrac{BT + SD - OI}{SS}$$

Substituting this value for $$p$$ into the first equation, and also the definition of relevant income, gives:

$$0.5 \cdot (UB - LB) + 0.85 \cdot (OI + 0.5 \cdot SS - UB) = BT + SD - OI$$

Expanding the large term on the left hand side gives:

$$0.5 \cdot (UB - LB) + 0.85 \cdot OI + 0.425 \cdot SS - 0.85 \cdot UB = BT + SD - OI$$

Rearranging to solve for OI:

$$1.85 \cdot OI = BT + SD + 0.85 \cdot UB - 0.5 \cdot (UB - LB) - 0.425 \cdot SS$$

The solution to this set of equations is:

$$OI = \dfrac{BT + SD + 0.85 \cdot UB - 0.5 \cdot (UB-LB)}{1.85} - \dfrac{0.425 \cdot SS}{1.85}$$

$$\dfrac{0.425}{1.85} \approx 0.22973 \approx 0.23$$

22.2% bump ends
The 22.2% bump ends when the maximum of 85% of Social Security benefits becomes taxable. This occurs when:

$$0.5 \cdot (UB - LB) + 0.85 \cdot (RI - UB) = 0.85 \cdot SS$$

Substituting the definition for relevant income gives:

$$0.5 \cdot (UB - LB) + 0.85 \cdot (0.5 \cdot SS + OI - UB) = 0.85 \cdot SS$$

Expanding the large term on the left hand side gives:

$$0.5 \cdot (UB - LB) + 0.425 \cdot SS + 0.85 \cdot OI - 0.85 \cdot UB = 0.85 \cdot SS$$

Rearranging to solve for OI gives:

$$0.85 \cdot OI = 0.85 \cdot UB - 0.5 \cdot (UB - LB) + 0.425 \cdot SS$$

Dividing by 0.85 gives:

$$OI = \left ( UB - \frac{0.5}{0.85} \cdot (UB - LB) \right ) + 0.5 \cdot SS$$

40.7% bump begins
For both single and married filers, the 40.7% bump begins at the boundary of the 22% bracket. The formula is the same as for the beginning of the 22.2% bump for married filers, but with a different bracket threshold:

$$OI = \dfrac{BT + SD + 0.85 \cdot UB - 0.5 \cdot (UB-LB)}{1.85} - \dfrac{0.425 \cdot SS}{1.85}$$

40.7% bump ends
The line where the 40.7% bump ends is the same as where the 22.2% bump ends. The only difference is whether the boundary is above or below $$SS^{*}$$.

$$OI = \left ( UB - \frac{0.5}{0.85} \cdot (UB - LB) \right ) + 0.5 \cdot SS$$

Variable Marginal Rates with Section 199A Deduction
Define variables:

$$ \begin{align} T(N, Q) & = \text{tax liability as a function of income} \\ N & = \text{non-Qualified Business Income} \\ Q & = \text{Qualified Business Income} \\ TB & = \text{tax bracket (eg. 24 percent)} \\ D & = \text{below-the-line deduction (eg. standard deduction)} \\ UL & = \text{upper limit of deduction phase-out (eg. 464,200 for MFJ 2023)} \\ R & = \text{phase-out range (eg. 100,000 for MFJ 2023)} \\ \end{align} $$

This analysis will assume a single tax bracket, although because the equation will be differentiated, the results will apply to any tax bracket.

The total tax liability can be written as follows. If total taxable income is below the beginning of the deduction phase-out ($232,100 for single or $464,200 for MFJ, for 2023), total tax is:

$$T(N, Q) = (N+Q-D) \cdot TB - 20% \cdot Q \cdot TB$$

In the phase-out range ($182,100-$232,100 for single or $364,200-$464,200 for MFJ), total tax is:

$$T(N, Q) = (N+Q-D) \cdot TB - 20% \cdot Q \cdot \left ( \frac{UL - (Q + N - D)}{R} \right ) \cdot TB$$

Above the phase-out range ($232,100 for single or $464,200 for MFJ), total tax is:

$$T(N, Q) = (N+Q-D) \cdot TB $$

Above the phase-out, the Section 199A deduction has no effect. Below the phase-out, the marginal tax rates with respect to QBI and non-QBI are found by taking the partial derivative of T with respect to N and Q:

$$\frac{\partial T(N, Q)}{\partial N} = TB$$

$$\frac{\partial T(N, Q)}{\partial Q} = (1 - 20%) \cdot TB = 80% \cdot TB$$

In the phase-out range, the marginal tax rates with respect to QBI and non-QBI are found by taking the partial derivative of T with respect to N and Q:

$$\frac{\partial T(N, Q)}{\partial N} = TB - 20% \cdot Q \cdot \left ( \frac{-1}{R} \right ) \cdot TB$$

$$\frac{\partial T(N, Q)}{\partial N} = TB \cdot \left ( 1 + \frac{20% \cdot Q}{R} \right )$$

$$\frac{\partial T(N, Q)}{\partial Q} = TB - \frac{\partial}{\partial Q} \left ( \frac{20% \cdot TB}{R} \cdot (UL \cdot Q - Q^2 - N \cdot Q + D \cdot Q)\right )$$

$$\frac{\partial T(N, Q)}{\partial Q} = TB - \frac{20% \cdot TB}{R} \cdot (UL - 2Q - N + D)$$

$$\frac{\partial T(N, Q)}{\partial Q} = TB \cdot \left ( 1 + \frac{20%}{R} \cdot (2Q + N - UL - D) \right )$$

The second partial derivatives are:

$$\frac{\partial^2 T(N, Q)}{\partial N^2} = 0$$

$$\frac{\partial^2 T(N, Q)}{\partial Q^2} = \frac{2 \cdot TB \cdot 20%}{R}$$

$$\frac{\partial^2 T(N, Q)}{\partial Q \partial N} = \frac{TB \cdot 20%}{R}$$

Example
A MFJ couple has $120,000 of non-QBI income and also earns QBI. They take the standard deduction of $27,700. Below $364,200 of taxable income, they are in the 24% bracket. Their marginal tax rates for non-QBI and QBI income are:

$$\frac{\partial T(N, Q)}{\partial N} = 24%$$

$$\frac{\partial T(N, Q)}{\partial Q} = 80% \cdot 24% = 19.2%$$

The phase-out begins when their taxable income, after the standard deduction, equals $364,200. This corresponds to a QBI income of $271,900 ($364,200 + $27,700 - $120,000). Note that although their taxable income is at the 24%/32% threshold, the Section 199A deduction pulls them well down into the 24% bracket. At this income, their marginal tax rates are:

$$\frac{\partial T(N, Q)}{\partial N} = 24% \cdot \left ( 1 + \frac{20% \cdot $271,900}{$100,000} \right ) = 37.05%$$

$$\frac{\partial T(N, Q)}{\partial Q} = 24% \cdot \left ( 1 + \frac{20%}{$100,000} \cdot (2 \cdot $271,900 + $120,000 - $464,200 - $27,700) \right ) = 24% \cdot \left ( 1 + \frac{20%}{$100,000} \cdot $171,900 \right ) = 32.25%$$

At some point in the phase-out range, the couple will cross into the 32% bracket, and then into the 35% bracket. At the top of the phase-out, when QBI income is $371,900 ($464,200 + $27,700 - $120,000), marginal tax rates will be:

$$\frac{\partial T(N, Q)}{\partial N} = 35% \cdot \left ( 1 + \frac{20% \cdot $371,900}{$100,000} \right ) = 61.03%$$

$$\frac{\partial T(N, Q)}{\partial Q} = 35% \cdot \left ( 1 + \frac{20%}{$100,000} \cdot (2 \cdot $371,900 + $120,000 - $464,200 - $27,700) \right ) = 35% \cdot \left ( 1 + \frac{20%}{$100,000} \cdot $371,900 \right ) = 61.03%$$

Above $371,900 QBI, the Section 199A deduction is completely eliminated and the marginal rates become:

$$\frac{\partial T(N, Q)}{\partial N} = \frac{\partial T(N, Q)}{\partial Q} = 35%$$

Maximum possible rates
By inspection of the above formulas, the maximum possible rates occur at the very top of the phase-out range, when:

$$N + Q - D = UL$$

The maximum also occurs when Q is largest, so:

$$N = 0$$

and

$$Q = UL + D$$

Substituting these values into the above equations for the marginal rates give:

$$\frac{\partial T(N, Q)}{\partial N} = TB \cdot \left ( 1 + \frac{20% \cdot (UL + D + N)}{R} \right )$$

and

$$\frac{\partial T(N, Q)}{\partial Q} = TB \cdot \left ( 1 + \frac{20%}{R} \cdot (2 \cdot (UL+D) + 0 - UL - D) \right ) = TB \cdot \left ( 1 + \frac{20%}{R} \cdot (UL + D) \right ) $$

Note that the two formulas are the same.

For single filers for 2023, UL = $232,100 and R = $50,000, and we will assume the standard deduction D = $13,850. $232,100 taxable income is barely in the 35% bracket, which begins at $231,250 taxable income, so TB = 35%.

$$\left (\frac{\partial T(N, Q)}{\partial N} \right )_{max} = \left (\frac{\partial T(N, Q)}{\partial Q} \right )_{max} = 35% \cdot \left ( 1 + \frac{20% \cdot ($232,100 + $13,850)}{$50,000} \right ) = 69.43%$$

The QBI required to achieve this rate is:

$$Q = $232,100 + $13,850 = $245,950$$

For married joint filers for 2023, UL = $464,200 and R = $100,000, and we will assume the standard deduction D = $27,700. $491,900 taxable income is barely into the 35% bracket, which begins at $490,200 taxable income, so TB = 35%.

$$\left (\frac{\partial T(N, Q)}{\partial N} \right )_{max} = \left (\frac{\partial T(N, Q)}{\partial Q} \right )_{max} = 35% \cdot \left ( 1 + \frac{20% \cdot ($464,200 + $27,700)}{$100,000} \right ) = 69.43%$$

The QBI required to achieve this rate is:

$$Q = $464,200 + $27,700 = $491,900$$

Note that the single and married joint maximum rates are the same, because the married standard deduction, phase-out range, and tax bracket boundary are all double the single values. If itemized deductions are larger than the standard deduction, the maximum rate will be slightly higher.