$a^2-b^2 = x$ where $a,b,x$ are natural numbers Suppose that $a^2-b^2 =x$ where $a,b,x$ are natural numbers.
Suppose $x$ is fixed. If there is one $(a,b)$ found, can there be another $(a,b)$?
Also, would there be a way to know how many such $(a,b)$ exists?
 A: You want $x = a^2 - b^2 = (a-b)(a+b)$. Let $m = a-b$ and $n = a+b$, then note that $a = (m+n)/2$ and $b = (n-m)/2$. For these to be natural numbers, you want both $m$ and $n$ to be of the same parity (i.e., both odd or both even), and $m \le n$. For any factorization $x = mn$ satisfying these properties, $a = (m+n)/2$ and $b = (n-m)/2$ will be a solution.
The answer to your question of how many such $(a,b)$ exist is therefore the same as how many ways there are of writing $x = mn$ with both factors of the same parity and $m \le n$. Let $d(x)$ denote the number of divisors of $x$. (For instance, $d(12) = 6$ as $12$ has $6$ factors $1, 2, 3, 4, 6, 12$.)


*

*If $x$ is odd, note that for any divisor $m$ of $x$, the factorization $x = mn$ (where $n = x/m$) has both factors odd. Also, out of any two factorizations $(m,n)$ and $(n,m)$, one of them will have $m < n$ and the other will have $m > n$, so the number of "good" factorizations of $x$ is $d(x)/2$. In the case where $x$ is a perfect square, this means either $\lceil d(x)/2 \rceil$ or $\lfloor d(x)/2 \rfloor$ depending on whether or not you want to allow the solution $a = \sqrt{x}$, $b = 0$.

*If $x$ is even, then $m$ and $n$ can't be both odd so they must be both even, so $x$ must be divisible by $4$. Say $x = 2^k \cdot l$, where $k \ge 2$. How many factorizations $x = mn$ are there with both $m$ and $n$ being even? Well, there are $d(x)$ factorisations of $x$ as $x = mn$. Of these, the factorisations in which all the powers of $2$ go on one side can be got by taking any of the $d(l)$ factorisations of $l$, and then putting the powers of two entirely on one of the $2$ sides. So the number of representations $x = mn$ with $m$ and $n$ both being even is $d(x) - 2d(l)$. Again, the number where $m \le n$ is half that, namely $(d(x) - 2d(l))/2$, where in the case $x$ is a perfect square, you mean either $\lceil (d(x) - 2d(l))/2 \rceil$ or $\lfloor (d(x) - 2d(l))/2 \rfloor$ depending on whether you want to allow the $b = 0$ solution or not.

Here is a program using Sage that can print all solutions $(a,b)$ for any given $x$.
#!/path/to/sage

print "Hello"
def mn(x):
  '''Returns all (m,n) such that x = mn, m <= n, and both odd/even'''
  for m in divisors(x):
    n = x/m
    if m <= n and (m % 2 == n % 2): yield (m,n)
    elif m > n: break
def ab(x):
  '''Returns all (a,b) such that a^2 - b^2 = x'''
  return [((m+n)/2, (n-m)/2) for (m,n) in mn(x)]

def num_ab(x):
  '''The number of (a,b) such that a^2 - b^2 = x'''
  dx = number_of_divisors(x)
  if x % 2: return ceil(dx / 2)
  l = odd_part(x)
  dl = number_of_divisors(l)
  return ceil((dx - 2*dl) / 2)

# Do it in two ways to check that we have things right
for x in range(1,1000): assert num_ab(x) == len(ab(x))
# Some examples
print ab(12)
print ab(100)
print ab(23)
print ab(42)
print ab(999)
print ab(100000001)

It prints:
Hello
[(4, 2)]
[(26, 24), (10, 0)]
[(12, 11)]
[]
[(500, 499), (168, 165), (60, 51), (32, 5)]
[(50000001, 50000000), (2941185, 2941168)]

and you can verify that, for instance, $168^2 -165^2 = 999$.
A: You need to exploit the fact that the right hand side of your equation can be factored. For example for part (1) of the exercise, if $x$ is odd, say $x = 2n+1$ for some integer $n$, then
$$
x = 2n + 1 = y^2 - z^2 = (y - z)(y + z)
$$ 
Now try to consider a trivial factorization of $2n+1$ like $2n+1 = 1 \cdot (2n+1)$ and compare the two factorizations to get a system of equations
$$
\begin{align}
y - z &= 1\\
y + z &= 2n + 1
\end{align}
$$
I think you can take it from here, but feel free to ask if you get stuck.
A: Note that $a^2-b^2=(a+b)(a-b)$ and that $(a+b)=c$ and $(a-b)=d$ are either both odd or both even.
If $x=cd$ where $c>d$ and $c$ and $d$ have the same parity then $a=\frac {c+d}2, b=\frac {c-d}2$ are natural numbers which work for $x$.
It is always possible to express an odd number $x$ in this way, using $c=x, d=1$. If $x$ is prime there is no other factorisation.
If $x$ is even, it must be divisible by 4, and if $x=4y$ then $c=2y, d=2$ will do provided $y>1$.
The number of solutions depends on the number of factorisations into factors of like parity.
A: Any number N can be represented as product of two no's .
$$ N= a*b =({a+b\over 2})^2 - ({a-b\over 2})^2  $$
$$ To\ be\ difference\ of\ perfect\ squares\ the\ condition\ is\ ({a+b\over 2}) and \ ({a-b\over 2}) \ should\ be\ integers\ .$$ 
This happens only iff 
1) a and b are odd
or
2) a and b are even
eg. $$ 100 = 2^2 * 5^2 $$ 
So number of factors in 100= (2+1)(2+1) =9
They are  1,2,4,5,10,20,25,50,100 
To find pairs of numbers which gives product 100 ,(trick is take corresponding numbers comming from opposite ends from the list above )
so 100 = 1*100 , 2*50 , 4*25 , 5*20  ( dont take the middle number in case the number is itself as square like 100 = 10^2)
here the pair which satisfies the condition is
2*50 ( even * even) , so a=50 , b=2
now calculate ,$$ ({a+b\over 2})\ and\  ({a-b\over 2})  $$
So 
$$ 100 = 26^2 - 24^2 $$ is the only possibilty 
