Step 1: Understanding the Question:
The denominator \( x^2-a^2 \) is a difference of two squares, so it factorises as \( (x-a)(x+a) \). When the denominator splits into two different linear factors, partial fractions is the natural tool.
Step 2: Split into partial fractions:
Write \( \frac{1}{x^2-a^2} = \frac{A}{x-a} + \frac{B}{x+a} \).
Multiply both sides by \( (x-a)(x+a) \): \( 1 = A(x+a) + B(x-a) \).
Put \( x = a \): \( 1 = 2aA \), so \( A = \frac{1}{2a} \).
Put \( x = -a \): \( 1 = -2aB \), so \( B = -\frac{1}{2a} \).
\[ \frac{1}{x^2-a^2} = \frac{1}{2a}\left[\frac{1}{x-a} - \frac{1}{x+a}\right] \]
Step 3: Integrate each part:
Each term is of the form \( \int\frac{dx}{x\pm a} = \log|x\pm a| \).
\[ \int\frac{dx}{x^2-a^2} = \frac{1}{2a}\left[\log|x-a| - \log|x+a|\right] + k \]
Using \( \log p - \log q = \log\frac{p}{q} \),
\[ \int\frac{dx}{x^2-a^2} = \frac{1}{2a}\log\left|\frac{x-a}{x+a}\right| + k \]
This is option (B).
Step 4: Why the other options are wrong:
Option (A): \( \frac{1}{a}\tan^{-1}\frac{x}{a} \) is the integral of \( \frac{1}{x^2+a^2} \), with a plus sign in the denominator.
Option (C): \( \frac{1}{2a}\log\left|\frac{a+x}{a-x}\right| \) is the integral of \( \frac{1}{a^2-x^2} \). It differs from the answer by a minus sign, because the fraction inside the log is flipped.
Option (D): its derivative is \( \frac{2}{x^2-a^2} \), which is double the required integrand. The factor \( \frac{1}{2a} \) has been replaced by \( \frac{1}{a} \).
Final Answer:
By partial fractions, \( \int\frac{dx}{x^2-a^2} = \frac{1}{2a}\log\left|\frac{x-a}{x+a}\right| + k \). This is option (B).
\[ \boxed{\frac{1}{2a}\log\left|\frac{x-a}{x+a}\right| + k} \]