# simplifying expression

Hi,

I want to get an expand an expression of the form and finally get the rhs of the below expression

\begin{align} \Big(\frac{A1{a}}{r}+\frac{A2{a}}{r^{2}}\Big)\Big(\frac{B1{a}}{r}+\frac{B2{a}}{r^{2}}\Big)=\frac{A1{a}B1{a}}{r^{2}}+\frac{A1{a}B2{a}+A2{a}B1{a}}{r^{3}}+\frac{A2{a}B2{a}}{r^{4}} \end{align}

For this i used the following code

$ch3:=((A0{a}/r)+(A0{a}/r2))((B0{a}/r)+(B0{a}/r2));$

$distribute(ch3);$

$simplify(_);$

But finally i am getting the expression \begin{align} A1{a}B1{a}r^{-1}r^{-1}+A1{a}B2{a}r^{-2}r^{-1}+A2{a}B1{a}r^{-2}r^{-1}+A2{a}B2{a}r^{-2}r^{-2} \end{align}

It is not simplifying after this to get the rhs of the expression i wanted in the beginning. I have just shown a simple expression for the convenience of expressing my doubt. The actual expression is pretty large.

It would be helpful if the mistake I am doing can be pointed out and how to simpify the mathematical expressions.

I was able to resolve this issue. After the last command, I added collect_factors() which did the job.