Q:

Why multiply by $3^x/3^x$?

I was wondering is there a way to know what to multiply by? I just don't understand where $3^x/3^x$ came from. How did my teacher know that that's what we're supposed to multiply by? I understand how to do after that but that one part has stumped me. It was given as a hint. 

A:

Actually your teacher explained it pretty well.
It is a trick that makes integral calculation easier. Your teacher is trying to match $e^{-3y}$ to $3^xy^x=(3y)^x$ in order to use the substitution method $u=3y$
Because $\frac{3^x}{3^x}=1$, multiplying this term to the whole integral will not change the result.
If you have something like $e^{-6y}$ instead in your integral, you will probably be doing $\frac{6^x}{6^x}$

A:

You can skip that step and instead just substitute $u=3y$ immediately into $$\frac{2^x}{x!}\int_0^\infty e^{-3y}y^xdy$$ to get $$\frac{2^x}{x!}\int_0^\infty e^{-u}(u/3)^x\frac{du}{3}=\frac{2^x}{x!}\int_0^\infty \frac{e^{-u}u^xdu}{3^x\cdot 3}=\frac{2^x}{x!3^{x+1}}\int_0^\infty e^{-u}u^xdu.$$
This of course gives the same result, but doesn't require you to magically come up with multiplying by $3^x/3^x$.  If you already knew this is how it was going to work out, you could see that you could factor out the $3^x$ before making the substitution.  This is what your teacher presumably did.

A:

As you mention, tricks are often clear in retrospect and not always easy to see immediately. Practice surely helps! The more problems you solve the easier it will be to see a few steps ahead.
In this case, notice that the integrand in last equation on the first line is $e^{-3y}y^x$. This equation sort of looks like the pdf of a gamma distribution. What the professor did is, essentially, add the missing pieces so that you end up with exactly a gamma distribution. Then, you can use the fact that a pdf always integrates to $1$ (if you integrate over all possible values) to get the solution you want. Of course, you can't just multiply by something in order to get the equation you want, you also have to divide by it (to keep your expression valid).

