Hi, I'm trying to work on a formula that can calculate the tax payable given that we have different tax rates for different thresholds. So for example, let's say we have the following tax table.
Taxable Income Marginal Tax Rate $0 - $10,000 10% $10,0001 - $20,000 15%
So, if our income is $x, is there some formula I could use to calculate the tax payable. I know that this can be very easily calculated once we have $x. Although is there a formula as a function of $x that could calculate the tax payable? I was initially thinking of using matrices, although I'm not too sure how that would work. Any suggestions would be appreciated.