'Equating the coefficients' question

1. Sep 24, 2016

Parsifal1

1. The problem statement, all variables and given/known data
Expand the brackets to get a cubic containing the unknowns. This is an example in the textbook but I don't see how they've expanded the brackets to get their answer:

(x-3)(px^2+qx+r)=px^3+(q-3p)x^2+(r-3q)x-3r

2. Relevant equations
(x-3)(px^2+qx+r)

3. The attempt at a solution

I would have done it how you expand long brackets:

(x-3)(px^2)+(x-3)(qx)+(x-3)(r)=px^3-3px^2...

2. Sep 24, 2016

pasmith

Yes, and the next step is to collect all the terms involving x^2 together, and all the terms involving x together...

3. Sep 24, 2016

Parsifal1

What I don't get is how they factorized what you get from expanding: px^3+qx^2+rx-3px^2-3qx-3r. How do you get px^3+(q-3p)x^2+(r-3q)x-3r from that?

4. Sep 24, 2016

Parsifal1

Ah, I see if you do (q-3p)x^2 and multiply it out and the same with the other factorized terms, you get the terms you get when you'd first expand it out. I hadn't noticed that px^3+(q-3p)x^2... etc. was a cubic. I need to work on noticing things, I've found.