# Penetrate (multiply) a factor into an existing expression

I have an expression, say for instance $$\rm{expression}=7+2a(x+1)^2+3a^4(y-2)(x+5)$$. I would like to further multiply this expression by $$a$$ and I aim for a result of the form $$7a+2a^2(x+1)^2+3a^5(y-2)(x+5)$$. However, when I do $$a*$$ the expression, it generates $$a[7+2a(x+1)^2+3a^4(y-2)(x+5)]$$ which did not penetrate that $$a$$ into the original expression. On the other hand, if I do $$\rm{Expand[a*(7+2a(x+1)^2+3a^4(y-2)(x+5))]}$$, it generates $$7a+2 a^2 - 30 a^5 + 4 a^2 x - 6 a^5 x + 2 a^2 x^2 + 15 a^5 y + 3 a^5 x y$$ which corresponds to a full expansion.

All I need is to rise exponents of $$a$$ in the original expression by one, so $$a^n$$ becomes $$a^{n+1}$$ for all $$n\geq 0$$, while holding all other terms stay unchanged. How could I implement that?

Note: I also tried the replacement-type command $${\rm{expression}}/.a^n\to a^{n+1}$$, but it only rises those exponents greater than 1, namely I got $$7+2 a (1 + x)^2 + 3 a^5 (5 + x) (-2 + y)$$.

• These are all equivalent forms, what's the point? – yarchik Mar 13 at 22:42
• Use Distribute, e.g., Distribute[a * expression]. Also, you should provide copyable plaintext to make life easier for people answering your question. – Carl Woll Mar 13 at 22:52
• Have you seen Collect ? – LouisB Mar 13 at 22:53

## 1 Answer

Try this:

p[x_,y_, a_] := 7 + 2 a (x + 1)^2 + 3 a^4 (y - 2) (x + 5)
Collect[a*p[x, y, a], a, FullSimplify]