Let $f$ be a function such that $ \sqrt {x - \sqrt { x + f(x) } } = f(x) , $ Let $f$ be a function such that $$ \sqrt {x - \sqrt { x + f(x) } } = f(x) , $$ for $x > 1$. In that domain, $f(x)$ has the form $\frac{a+\sqrt{cx+d}}{b},$ where $a,b,c,d$ are integers and $a,b$ are relatively prime. Find $a+b+c+d.$
 A: Let's write $f$ for $f(x)$.
\begin{align}
\sqrt{x-\sqrt{x+f}}&=f\\
x-\sqrt{x+f}&=f^2\\
\sqrt{x+f}&=-f^2+x\\
x+f&=f^4-2xf^2+x^2\\
0&=f^4-2xf^2-f+x^2-x
\end{align}
This looks like a very ugly equation to solve. We want to factor that somehow (maybe there's some difference of squares in there? I can't see it...) Since we have nothing else to do, let's complete the square on the right. (Why? Well, I'm hoping for a difference of two squares somewhere, so getting a square in there seems like a good start.)
\begin{align}
0&=f^4-2xf^2-f+x^2-x\\
0&=f^4-2xf^2-f+\Big(x-\frac12\Big)^2-\frac14
\end{align}
Let's ignore the $-\frac14$ at the end for just one second, and look at the rest. What do we have here? Well, $f^4-\textit{something}+(x-\frac12)^2$. This is almost a square! (Remember that $(a-b)^2=a^2-2ab+b^2$; we have the $a^2$ and $b^2$ in here.)
So, let's try seeing what $(f^2-(x-\frac12))^2$ looks like. (Maybe we'll get lucky and find out that our thing actually is a square.)

\begin{align}
\Big(f^2-\left(x-\tfrac12 \right)\Big)^2&=f^4-2f^2 \left(x-\frac12 \right)+\Big(x-\frac12\Big)^2\\
&=f^4-2f^2x+f^2+\left(x-\frac12\right)^2
\end{align}

Drats — that's almost what we have. What we have is that thing, but with a $-f$ instead of a $+f^2$. In other words, we have $\textit{that thing}-f^2-f$. Well, let's put it into our equation above anyway:
\begin{align}
0&=f^4-2xf^2-f+\Big(x-\frac12\Big)^2-\frac14\\
&=\left(\left(f^2-\left(x-\tfrac12\right)\right)^2-f^2-f \right)-\frac14\\
&=\Big(f^2-\left(x-\tfrac12 \right)\Big)^2-f^2-f-\frac14
\end{align}
Woah! We can factor that...
\begin{align}
&=\Big(f^2-\left(x-\tfrac12 \right)\Big)^2-\left(f+\tfrac12 \right)^2
\end{align}
And suddenly it's the difference of two squares:
\begin{align}
&=\Big(f^2-\left(x-\tfrac12 \right)+\left(f+\tfrac12 \right)\Big)\Big(f^2-\left(x-\tfrac12 \right)-\left(f+\tfrac12 \right)\Big)\\
&=(f^2+f-x+1)(f^2-f-x)
\end{align}
Woohoo! We factored that beast. The end is in sight.
We now split this into two equations: $f^2+f-x+1=0$ and $f^2-f-x=0$. Each give us two possible solutions. After using the quadratic formula, we end up with
$$\frac{-1\pm\sqrt{4x-3}}2,\frac{1\pm\sqrt{4x+1}}2$$
Now, we need to test each of these to see which one works. Actually, this isn't too bad — we can just choose a good choice for $x>1$ for each of these (preferably a choice of $x$ that gives us lots of integers) and see if they work. (Why $x>1$? 'Cause that's what the problem says.)
So, let's pick good values of $x$ and plug them into the original equation: $\sqrt{x-\sqrt{x+f}}=f$.
Working with $x=3$, the first two solutions give me $1=1$ and $\sqrt2=-2$ respectively; working with $x=2$, the last two solutions give me $0=2$ and $1=-1$ respectively. Clearly, only the first one works; thus, the solution is:
$$f=\frac{-1+\sqrt{4x-3}}2$$
EDIT: Technically, they want you to find $a+b+c+d$. So, the answer is $(-1)+(2)+(4)+(-3)=2$.
