Substitution or comparison? For the question,
$X^4 + \frac{9}{X^4} = (X^2 - \frac{a}{X^2})^2 + b$ I have to find the values of $a$ and $b$. I tried two solutions both included the expansion of brackets. 
By comparing terms I obtained $3$ for $a$ and $6$ for $b$.
However when I tried to substitute using $b$, I obtained a value of $0$ for $b$.
Why is it not possible to solve by substituting and on a more general tone when is it possible to solve by substituting?

$X^4 + \frac{9}{X^4} = (X^2 - \frac{a}{X^2})^2 + b$
$x^4 + \frac {9}{x^4} = x^4 + \frac {a^2}{x^4} + b - 2a$
So by comparing $a^2 = 9$ and $b-2a = 0$.
So $a = 3$ or $a = -3$ and $b = 6$ or $b = -6$.
I'm not sure what you mean by substituting?  Do you mean picking an arbitrary  value for $x$ and getting two equations for $a$ and $b$.
Let $x = 1$.  then $10 = (1-a)^2 + b = 1 -2a + a^2 +b$ or $b= 9 + 2a -a^2$
if $x = \sqrt{2}$ then $4 +\frac 94 = (2- \frac a2)^2 +b = 4-2a + \frac{a^2}4 +b$ or $b=\frac 94 + 2a -\frac {a^2}4$
So $9-a^2 = \frac 94 - \frac {a^2}4 = \frac 14( 9 - a^2)$ so $9-a^2 = 0$ so $a = 3$ or $-3$.... and $b = 6$ or $-6$.
So how did you get $b= 0$?  Perhaps if we knew how you got that we can figure out what went wrong.  Did you divide by zero?  Did you get an redundant equation $0 = 0$ and mistake that for $b = 0$?
If $x = 0$ you get $0 + \frac 90 = (0 + \frac a0)^2 +b$ but this doesn't help us as dividing by zero is an absolute forbidden no-no that makes no sense.  If you make the error and assume $\frac 90 = 0$ (It does !!!!!!!!NOT!!!!!!!) then you get $0 = 0 + b$ (which is !!!!!!!!WRONG!!!!!!)
Of if you did $x = k$ and $x = -k$ you will end up with the redundant two equations: $k^4 + \frac 9{k^4} = (k^2 - \frac a{k^2})^2 + b$  repeated twice which gets us no where.
=====
from the comments it sounds like what you did was
$X^4 + \frac{9}{X^4} = (X^2 - \frac{a}{X^2})^2 + b$
$b = X^4 + \frac{9}{X^4}-(X^2 - \frac{a}{X^2})^2$ and then plug that back into the original
$X^4 + \frac{9}{X^4} = (X^2 - \frac{a}{X^2})^2+ X^4 + \frac{9}{X^4}-(X^2 - \frac{a}{X^2})^2$
$X^4 + \frac{9}{X^4}=X^4 + \frac{9}{X^4}$
$0 = 0$
Which is true.  Zero does equal 0.  But that doesn't help us in the least as it says nothing about $a$ or $ b$ or $x$.
If this is what you mean by "substitution" it will NEVER work.  You are simply defining something in terms of an expression and trying to solve the same expression with no new information and you simply eliminate everything in circular reasoning.  
It's a bit like trying to do "Snoopy = Charlie Brown's dog.  Solve for Charlie Brown"
Charlie Brown = Snoopy's owner
Snoopy = Snoopy's owner's dog
Snoopy = Snoopy
Snoopy - Snoopy = Snoopy - Snoopy
0 = 0
Therefore Charlie Brown is nobody!
Hopefully you can see why that is wrong and how it will never work.
