Progressive tax formula with variables I'm trying to figure out a formula to use in a tax calculator to calculate tax. 
I will try to explain this as best as possible.
There are 3 tax brackets:


*

*1% tax from $0-$10,000

*1%-40% tax from $10,000 to $150,000

*and a flat 40% tax rate from every dollar over $150,000
My question is, how do I figure out the tax from the 1%-40% tax gradient.
Eg: simplified, let's say tax is 0% to 100% up to 100k


*

*if you make 100k, 100k would go to the government

*if you make 10k, 1k would go to the government.

*if you make 50k, 25k would go to the government.


However, the introduction of a minimum tax rate complicates this too much for me.
In this system, your income directly determines the tax rate.
If you have any questions, I will try answer them ASAP
 A: First, I have no general knowledge of tax codes. Especially the interpretation for the second bracket (which is the one you used in the example) may be wrong.
First allocate the money you earn to the brackets, starting with the first.
Case A: If you earn \$30,000, then $10,000 go to the first bracket, \$20,000 go to the second and none to the third.
Case B: If you earn \$200,000, then $10,000 go to the first bracket, \$140,000 go to the second bracket and \$50,000 to the third.
For each bracket, figure out your tax rate. That's easy for the first and third bracket, as they are constant (1% and 40%, resp.)
For the second bracket, the starting tax rate of \$0 is 1%. I say that it starts at $0 because the \$10,000 in the original formulation takes into account that \$10,000 go into the first bracket. But that money has already been subtracted.
So again, in the second bracket the tax rate starts at 1% for \$0 and ends at 40% for \$140,000. So if you have \$m in the second bracket, your tax rate there is $1\% + (\frac{m}{140,000})\times39\%$. It's linear, and if you plug in $m=0$ you get the desired 1% and if you plug in $m=140,000$ you get the desired 40%.
So let's look at the 2 cases again.
Case A: 


*

*Tax rate in first bracket: 1%. You pay taxes: $0.01 \times \$10,000 =
   \$100$

*Tax rate in second bracket: $1\%+\frac{20,000}{140,000}\times 39\% = 6.57\%$ (rounded). You pay taxes: $0.0657 \times \$20,000 = \$1,314$.

*Tax rate in third bracket: 40%. You pay taxes: $0.40 \times \$0 = \$0$


Overall you pay taxes: \$1,414
Case B:


*

*Tax rate in first bracket: 1%. You pay taxes: $0.01 \times \$10,000 =
   \$100$

*Tax rate in second bracket: $1\%+\frac{140,000}{140,000}\times 39\% = 40\%$. You pay taxes: $0.40 \times \$140,000 = \$56,000$.

*Tax rate in third bracket: 40%. You pay taxes: $0.40 \times \$50,000 = \$20,000$


Overall you pay taxes: \$76,100
