\(\left(\frac{a}{a-1}-\frac{1}{a^2-a}\right):\left(\frac{1}{a+1}+\frac{2}{a^2-1}\right)=\left(\frac{a}{a-1}-\frac{1}{a\left(a-1\right)}\right):\left(\frac{1}{a+1}+\frac{2}{\left(a-1\right)\left(a+1\right)}\right)\)
\(=\frac{a^2-1}{a\left(a-1\right)}:\frac{a-1+2}{\left(a-1\right)\left(a+1\right)}=\frac{\left(a^2-1\right)\left(a-1\right)\left(a+1\right)}{a\left(a-1\right)\left(a+1\right)}=\frac{a^2-1}{a}=a-\frac{1}{a}\)