# How to solve $(a+\sqrt{b})^n - (a-\sqrt{b})^n = x$?

Consider equation $(a+\sqrt{b})^n - (a-\sqrt{b})^n = x$

How do I properly solve for $n$ given $x$?

-
What are your thoughts? Have you written out the brackets using the binomial theorem? – Alex B. Dec 12 '12 at 18:01
I don't even know where to begin with solving it because I don't know how to expand it with binomial theorem, although there is en.wikipedia.org/wiki/Binomial_theorem#Statement_of_the_theorem is this what you mean? – KaliMa Dec 12 '12 at 18:04
So does this mean (a+sqrt(b))^n is the sum from k=0 to n of (n choose k) a^k*sqrt(b)^(n-k)? – KaliMa Dec 12 '12 at 18:06
Correct. If you multiply this out, you will notice substantial cancellation. – Alex B. Dec 12 '12 at 18:09
@AlexB. I am not sure how to apply that here. I don't know the value of n as that's what I am solving for. I only know x. Therefore I am not sure how many terms I need to expand this by – KaliMa Dec 12 '12 at 18:11

There are many approaches. If you think $n$ is a small whole number, you can just try a range. A spreadsheet would make this easy. If one of $a+\sqrt b$ or $a-\sqrt b$ is smaller than $1$ it will to to zero as $n$ increases. To be definite, assume $a-\sqrt b$ is smaller than $1$. Let's ignore it for a moment. Then $n \approx \frac {\log x}{\log (a+\sqrt b)}$ where you can use your favorite base for the logs. You can use numerical methods. The left side will be monotonic with $n$, so any reasonable root-finder will work. Just graphing will get you very close.

As an example, suppose you want to find the index of a Fibonacci number. We are given that $\sqrt 5 F_n=(\frac {1+\sqrt 5}2)^n-(\frac {1-\sqrt 5}2)^n$. As $|\frac {1-\sqrt 5}2|\lt 1$, powers of it go to zero quickly. If somebody gives us $14930352$ and asks which number it is, we can just do $\frac {\log (14930352\sqrt 5)}{\log (\frac {1+\sqrt 5}2)}$ and get a number that is within $10^{-14}$ of $36$, so $n=36$

-
In my case, neither side has an absolute value less than 1 – KaliMa Dec 12 '12 at 18:09
@KaliMa: In that case I would graph it or use a spreadsheet – Ross Millikan Dec 12 '12 at 18:17
This was helpful, thank you – KaliMa Dec 12 '12 at 18:20

Consider equation $(a+\sqrt{b})^n - (a-\sqrt{b})^n = x$

Consult this link: The Binomial Theorem.

Since you are given $x$ (taken to be a constant), you can also try take logarithms of each side of the equation.

-
They are not squared, they are raised to power $n$ – KaliMa Dec 12 '12 at 18:07
Fixed: see the link. It will help you understand how to approach the problem. – amWhy Dec 12 '12 at 18:12
@amWhy Using your link, I took the original equation to: $\sum_{k=0}^n {n\choose k}a^k\sqrt b^{n-k} - \sum_{k=0}^n {n\choose k}a^k(-\sqrt b)^{n-k} = x$ Not sure where to go from there? I get it down to: $\sum_{k=0}^n {n\choose k}a^k({\sqrt b}^{n-k}-{(-\sqrt b)}^{n-k})= x$ – user17753 Dec 12 '12 at 19:44