Representing $\frac{1}{(x-a)(x+a)}$ as $\frac{A}{(x-a)}+\frac{B}{(x+a)}$ I have to find the nth derivative of
$$
f(x)=\frac{1}{(x-a)(x+a)}
$$
where $a \neq 0$. So first guess I have to represent it in a more differentiable form.
The solution goes like this:
$$\frac{1}{(x-a)(x+a)}=\frac{A}{(x-a)}+\frac{B}{(x+a)}, \space \space 1=A(x+a)+b(x-a)$$
Let $x=a$ then $A=\frac{1}{2a}$, and when $x=-a$, $B=\frac{-1}{2a}$.
Now, I get the first part, but how can we let $x$ to equal $a$ or to equal $-a$? Are we allowed to do such thing? What's the logic behind it?
Thanks in advance!
 A: I like the point of @GNU Supporter in the comment. I would go like this:
$$\frac{1}{(x-a)(x+a)}=\frac{A}{x-a}+\frac{B}{x+a}$$
$$\frac{1}{(x-a)(x+a)}=\frac{A(x+a)}{(x-a)(x+a)}+\frac{B(x-a)}{(x-a)(x+a)}$$
And now you multiply with $(x-a)(x+a)$ with condition that $x$ is not $a$ nor $-a$:
$$1 = A(x+a) + B(x-a)$$
Now $(A+B)*x = 0$, and $1=(A-B)*a$.
So $A=-B$ and $1=2A*a$. 
$A=1/(2a)$ and $B=-1/(2a)$
A: The partial fraction is true for all (defined) values so as long as the value you put in is in the 'domain' then the partial fraction must hold. Hence, we use a value that eliminates one term to find the value of the other coefficient.
A: It is just a practical way to find $A, B$ and in general works for the product of the terms on the denominator involving simple roots. Actualll $A$ is a limit value. For example to find $A$: You multiply both sides of this equality 
$$\frac{1}{(x-a)(x+a)}=\frac{A}{x-a}+\frac{B}{x+a}$$
by $x-a\,$ you get
$$\frac{1}{x+a}=A+\frac{B(x-a)}{x+a}.$$ Now taking the limit as $x$ goes to $a$ you find $A=1/2a$. To find $B$ you will do the same thing but this time multiply by $x+a$.
A: Original problem
In fact, the problem itself has nothing to do with real-analysis, not even calculus.  In fact, it's simply an algebra question.  I wonder why don't we think from the definitions of the algebraic structures in which these fractions and polynomials are living.  To use calculus, we are unnecessarily assuming the order structure "$x<y$".
\begin{align}
\frac{1}{(x-a)(x+a)}&=\frac{A}{(x-a)}+\frac{B}{(x+a)}=\frac{A(x+a)+B(x-a)}{(x-a)(x+a)} \label{eq1}\tag{1}\\
1&=A(x+a)+B(x-a) \label{eq2}\tag{2}
\end{align}
Note that \eqref{eq1} takes place in the field of fractions of polynomial $\Bbb{R}(X)$.  From the very definition of fraction field
$$\Bbb{R}(X)=\left\lbrace \frac{p(X)}{q(X)} : p(X),q(X) \in \Bbb{R}[X] \text{ with } q(X)\ne0 \right\rbrace/\sim,$$
where $\sim$ denotes the equivalent relation $p_1(X)q_2(X)=p_2(X)q_1(X)$ for any $p_i(X),q_i(X)\in\Bbb{R}[X], i=1,2$, feel free to cancel out the denominators $(x-a)(x+a)\ne0$ in the integral domain $\Bbb{R}[X]$.
So we are left with \eqref{eq2} as an equality in $\Bbb{R}[X]$, which allows us to do substitutions mentioned in the question and in others answers.
Extended problem (in response to a reply to my comment)

  
*
  
*What if one has $$\frac{1}{(x-a_1)(x-a_2)\cdots(x-a_n)}=\frac{A_1}{x-a_1}+\cdots+\frac{A_n}{x-a_n}?$$
     Answer: a special case of the next question
  
*What if one has $$\frac{r(x)}{(x-a_1)(x-a_2)\cdots(x-a_n)}=\frac{A_1}{x-a_1}+\cdots+\frac{A_n}{x-a_n}?$$ for any degree $n-1$ polynomial $r(x) \in R[X]$? (What conditions are needed are $R$?  To be seen at the bottom.)
  



*

*Multiply both sides by the denominator to get an equality in the integral domain $R[X]$.
$$\begin{aligned}
r(x) =& A_1(x-a_2)\cdots(x-a_n)+\cdots+A_i(x-a_1)\cdots(x-a_{i-1})(x-a_{i+1})\cdots(x-a_n) \\
&+\cdots+A_n(x-a_1)\cdots(x-a_{n-1}) \\
=& A_1(x-a_2)\cdots(x-a_n)+(x-a_1)H(x) \quad\text{for some } H(x) \in R[X]
\end{aligned}$$
In the first step, the RHS is a sum of $n$ terms $A_i \in R$ multiplied by $(x-a_1)\cdots(x-a_n)$ without $x-a_i$. (Here $a_i \in R$.)


Substitute $x=a_1$ to kill $H(x)$ in slow motion, so that we understand what assumptions in needed for $R$.
$$
\require{cancel}
r(a_1) = A_1(a_1-a_2)\cdots(a_1-a_n)+\cancelto{0}{(a_1-a_1)H(a_1)} \label{eq3} \tag{3}
$$
Up to this stage, we have only considered $R$ as an integral domain, in which the cancellation law holds.
To make $A_1$ the subject of the \eqref{eq3}, we divide $(a_1-a_2)\cdots(a_1-a_n)$ on both sides, and such operation requires stability by division.  As a consequence, $R$ needs to be field just because of the last step.
$$\bbox[2px, border: 1px solid black]{A_1=\frac{r(a_1)}{(a_1-a_2)\cdots(a_1-a_n)}}$$
Other coefficients $A_i$ can be determined with a similar argument.
(More rigorously, we are applying the Factor Theorem, which holds for any commutative rings.
$$r(x)-A_1(x-a_2)\cdots(x-a_n)=(x-a_1)H(x).$$
RHS is divisible by $x-a_1$, so as LHS.  The Factor Theorem allows us to substitute $x=a_1$ on LHS and equate it to $0$.)
A: $$\frac{1}{(x-a)(x+a)}=\frac{A}{x-a}+\frac{B}{x+a}$$implies 
$$\frac{1}{x+a}=A+\frac{B(x-a)}{x+a}.$$
$$\frac{1}{x-a}=B+\frac{B(x+a)}{x-a}.$$
Taking $x=\pm a$ in both equalites we get $$A=\frac{1}{2a}~~~and  ~~~B=-\frac{1}{2a}$$
