2.
\(\left(\dfrac{a}{b^2}+\dfrac{1}{a}-\dfrac{1}{b}\right):\left(\dfrac{b}{a}+\dfrac{a^2}{b^2}\right)\)
\(=\left(\dfrac{a^2}{ab^2}+\dfrac{b^2}{ab^2}-\dfrac{ab}{ab^2}\right):\left(\dfrac{b^3}{ab^2}+\dfrac{a^3}{ab^2}\right)\)
\(=\dfrac{a^2+b^2-ab}{ab^2}:\dfrac{\left(a+b\right)\left(a^2+b^2-ab\right)}{ab^2}\)
\(=\dfrac{a^2+b^2-ab}{ab^2}.\dfrac{ab^2}{\left(a+b\right)\left(a^2+b^2-ab\right)}\)
\(=\dfrac{1}{a+b}\)
1.
\(\left(a-\dfrac{x^2+a^2}{x+a}\right)\left(\dfrac{2a}{x}-\dfrac{4a}{x-a}\right)\)
\(=\dfrac{ax+a^2-x^2-a^2}{x+a}.\dfrac{2ax-2a^2-4ax}{x\left(x-a\right)}\)
\(=\dfrac{ax-x^2}{x+a}.\dfrac{-2a^2-2ax}{x\left(x-a\right)}\)
\(=\dfrac{x\left(a-x\right)}{x+a}.\dfrac{2a\left(x+a\right)}{x\left(x-a\right)}\)
\(=2a\)