Find principal borrowable given monetary deposit, term and monthly payment. With a catch Edit: I reworded the entire question into an example to make it easier to understand
John wants to buy a house. He has €30,000 saved up for a deposit $(D)$ and he know's he can afford to pay €1,200 a month on mortgage repayments $(P)$ and he knows that he wants a mortgage which is 25 years (300 months) long $(N=300)$
He goes to his bank manager and asks what mortgage rate he can get. Bank manager says 'well it depends on what proportion of the total cost of the house $(C)$ that you buy that your deposit represents. If it's between 1% and 15% of $C$ then I'll give you a rate $(R_1)$ of 5%, however if it's between 15% and 50% of $C$, I'll give you a rate of 4% $(R_2)$'.
Now John needs to work out the price for the most expensive house he can afford to buy $ie. C$.
Forst John tries to work out the effective rate $(i)$ he can get but since the rate he can get $(R)$ depends on the cost of the house he buys, which is unknown, the best he can do is
$$i=\frac{100R}{n}$$ where $n=$ the number of payments in a year $(12)$ since $R_1$ and $R_2$ are given in annual terms.
But now Johns equation for the largest mortgage he can afford
\begin{equation}
A=\frac{P}{i}[(1-(1+i)^{-N})]
\end{equation}
has 2 variables and he can't solve it. How does John solve this equation?
End Edit
Original question text. Can probably be ignored if you're new to the question.
Finding the principal given the three terms - rate, monthly payment and term length is easy using
\begin{equation}
A=\frac{P}{i}[(1-(1+i)^{-N})]
\end{equation}
where:
$A=$ Principal,
$P=$ Monthly Payment,
$N=$ total number of payments,
$i=$ effective rate. ie. i=100rate/12  
The question is, what happens when the interest rate varies with the deposit? Usually banks will offer a lower interest rate to people who front a large percentage of the principal themselves. So someone who puts up 10% of the principal will have to pay a higher interest rate than someone who puts up 50%.
This messes up the equation though because we don't know the interest rate until we figure out the proportion of the principal that the borrowers deposit represents but we can't figure that out until we calculate the interest rate.
What I've been trying to do is just assume that the supplied dollar deposit amount (say 30,000 dollars) is 10% of the principal. Lookup the rate associated with a 10% deposit (say 3.75% therefore i=0.003125) and use this to calculate a dollar amount for principal (this will be 233,403 dollars given that the monthly payment is 1200 dollars).
So now assuming that this figure for principal is 90% of the total (principal + deposit) and the borrowers deposit makes up 10% I can tell that my initial guess of 10% was wrong because
$$\frac{A}{.9} != 30,000+A$$
Is there a single method or technique I can use to iteratively move towards the right guess for deposit percentage?
 A: You can just calculate how much he can borrow at 4% and again at 5%.  He will be able to borrow less at 5%, but the 85% cap on 4% money may mean he can afford more house at 5%.  To stay within the 85% cap for 4% money, the €30,000 must be 15% of the house, so the maximum house is €200,000.  How does this compare with what he can buy at 5%?
A: You cannot specify so much: you are already trying to say the deposit of 30,000 is 1/9 of the loan principal, together with (it seems) a period of 300 months, an initial monthly interest rate of 0.3125%, as well as an unstated lower interest rate when the amount outstanding falls below half the sum of the principal plus deposit. 
What you need to do is drop one of these assumptions, possibly the 1/9.   For example, suppose the lower monthly interest rate is 0.25%: 
You know that you cannot borrow more than $\frac{1200}{0.3125} =384000$ as the amount outstanding would then rise each month.  On the other hand, if you borrow $233403$ then you will pay off the loan too quickly in under 294 months because of the lower interest rate applying from month 167.   $240000$ would take over 307 months to repay, so the desired number is somewhere between this, perhaps sbout $236350$, with the lower interest rate applying from month 171.  Add in your $30000$ deposit and you can afford a total of $266350$.
Alternatively, keep the 10% deposit idea, but drop the $30000$.  This time you can afford a total of almost $262450$, including a deposit of $26245$ and loan of $236205$, with the lower interest rate kicking in at month 174. 
Or forget the 300 months of the loan.  You have a deposit of $30000$ and a loan of $270000$, and it will take almost 381 months to repay (compared with over 389 months if there was no interest rate drop), with the lower interest rate applying from month 232.
In practice, I would be suprised if this worked.  Most fixed rate loans keep the rate fixed, and this scheme effectively needs refinancing part-way through.  Not only might that involve fess, but there is also no assurance that rates would not change in that time.
