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. 440,100 for MFJ 2022)} \\ R & = \text{phase-out range (eg. 100,000 for MFJ 2020)} \\ \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 ($220,050 for single or $440,100 for MFJ, for 2022), total tax is:

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

In the phase-out range ($170,050-$220,050 for single or $340,100-440,100 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 ($220,050 for single or $440,100 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 $25,900. Below $30,100 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 $340,100. This corresponds to a QBI income of $246,000 ($340,100 + $25,900 - $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 $246,000}{$100,000} \right ) = 35.808%$$

$$\frac{\partial T(N, Q)}{\partial Q} = 24% \cdot \left ( 1 + \frac{20%}{$100,000} \cdot (2 \cdot $246,000 + $120,000 - $440,100 - $25,900) \right ) = 24% \cdot \left ( 1 + \frac{20%}{$100,000} \cdot $146,000 \right ) = 31.008%$$

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 $346,000 ($440,100 + $25,900 - $120,000), marginal tax rates will be:

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

$$\frac{\partial T(N, Q)}{\partial Q} = 35% \cdot \left ( 1 + \frac{20%}{$100,000} \cdot (2 \cdot $346,000 + $100,000 - $440,100 - $25,900) \right ) = 35% \cdot \left ( 1 + \frac{20%}{$100,000} \cdot $346,000 \right ) = 52.22%$$

Above $346,000 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 2022, UL = $220,050 and R = $50,000, and we will assume the standard deduction D = $12,950. $220,050 taxable income is barely in the 35% bracket, which begins at $215,950 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 ($220,050 + $12,950)}{$50,000} \right ) = 67.62%$$

The QBI required to achieve this rate is:

$$Q = $220,050 + $12,950 = $231,000$$

For married joint filers for 2022, UL = $440,100 and R = $100,000, and we will assume the standard deduction D = $25,900. $440,100 taxable income is barely into the 35% bracket, which begins at $431,900 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 ($440,100 + $25,900)}{$100,000} \right ) = 67.62%$$

The QBI required to achieve this rate is:

$$Q = $440,100 + $25,900 = $462,000$$

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.