I need help understanding whats going on...

Let f(x)=(x^2)-1 and g(x)=3x.

Find f * g.

1.(f * g)(x)=f(g(x))

2.---------=f(3x)

3.---------=((3x)^2)-1

4.---------=(9x^2)-1

I primarily dont understand line 3. How can 3x((x^2)-1)=((3x)^2)-1 ?

Perhaps you have a better way of explaining.

Trying to teach myself Algebra 2.