Answer
$ \frac{2a^2-13a-31}{(a+5)(2a-10)}$.
Work Step by Step
The given expression is
$\Rightarrow \frac{\frac{3}{a^2+10a+25}-\frac{1}{a^2-a-2}}{\frac{4}{a^2+6a+5}-\frac{2}{a^2+3a-10}}$
First solve the numerator.
$=\frac{3}{a^2+10a+25}-\frac{1}{a^2-a-2}$
Factor all terms.
$= a^2+10a+25$
Rewrite the middle term $10a$ as $5a+5a$.
$= a^2+5a+5a+25$
Group terms.
$= (a^2+5a)+(5a+25)$
Factor each group.
$= a(a+5)+5(a+5)$
Factor out $(a+5)$.
$= (a+5)(a+5)$
$= a^2-a-2$
Rewrite the middle term $-a$ as $-2a+a$.
$= a^2-2a+a-2$
Group terms.
$= (a^2-2a)+(a-2)$
Factor each group.
$= a(a-2)+1(a-2)$
Factor out $(a-2)$.
$= (a-2)(a+1)$
Substitute back all factors.
$=\frac{3}{(a+5)(a+5)}-\frac{1}{(a-2)(a+1)}$
The LCD of the denominators is $(a+5)(a+5)(a-2)(a+1)$.
$=\frac{3(a-2)(a+1)}{(a+5)(a+5)(a-2)(a+1)}-\frac{1(a+5)(a+5)}{(a+5)(a+5)(a-2)(a+1)}$
$=\frac{3(a-2)(a+1)-1(a+5)(a+5)}{(a+5)(a+5)(a-2)(a+1)}$
Use the FOIL method.
$=\frac{3(a^2-2a-2+a)-1(a^2+5a+5a+25)}{(a+5)(a+5)(a-2)(a+1)}$
$=\frac{3a^2-3a-6-a^2-10a-25}{(a+5)(a+5)(a-2)(a+1)}$
$=\frac{2a^2-13a-31}{(a+5)(a+5)(a-2)(a+1)}$
Now solve the denominator of the given fraction.
$=\frac{4}{a^2+6a+5}-\frac{2}{a^2+3a-10}$
Factor all terms.
$\Rightarrow a^2+6a+5$
Rewrite the middle term $6a$ as $5a+1a$.
$\Rightarrow a^2+5a+1a+5$
Group terms.
$\Rightarrow (a^2+5a)+(1a+5)$
Factor each group.
$\Rightarrow a(a+5)+1(a+5)$
Factor out $(a+5)$.
$\Rightarrow (a+5)(a+1)$
Factor all the terms.
$\Rightarrow a^2+3a-10$
Rewrite the middle term $3a$ as $5a-2a$.
$\Rightarrow a^2+5a-2a-10$
Group terms.
$\Rightarrow (a^2+5a)+(-2a-10)$
Factor each group.
$\Rightarrow a(a+5)-2(a+5)$
Factor out $(a+5)$.
$\Rightarrow (a+5)(a-2)$
Substitute back all factors.
$=\frac{4}{(a+5)(a+1)}-\frac{2}{(a+5)(a-2)}$
The LCD of the denominators is $(a+5)(a+1)(a-2)$.
$=\frac{4(a-2)}{(a+5)(a+1)(a-2)}-\frac{2(a+1)}{(a+5)(a+1)(a-2)}$
$=\frac{4(a-2)-2(a+1)}{(a+5)(a+1)(a-2)}$
$=\frac{4a-8-2a-2}{(a+5)(a+1)(a-2)}$
Simplify.
$=\frac{2a-10}{(a+5)(a+1)(a-2)}$
Back substitute all values into the given fraction.
$\Rightarrow \frac{\frac{2a^2-13a-31}{(a+5)(a+5)(a-2)(a+1)}}{\frac{2a-10}{(a+5)(a+1)(a-2)}}$
Invert the divisor and multiply.
$\Rightarrow \frac{2a^2-13a-31}{(a+5)(a+5)(a-2)(a+1)}\cdot \frac{(a+5)(a+1)(a-2)}{2a-10}$
Cancel common terms.
$\Rightarrow \frac{2a^2-13a-31}{(a+5)(2a-10)}$.