Here is the problem:

To illustrate the double marginalization problem, let’s assume that a manufacturer, m, and a retailer, r, use linear pricing

Inverse demand: p = 10 - q

Marginal cost of the manufacturer: c = 2

Marginal cost of the retailer: w

The timing of decisions

m sells to r at a wholesale price w

r sells to end-consumers at a price p

This game needs to be solved backward starting with the maximization problem of r

Here is where I'm stuck:

Profit(retailer) =

now I need to take the derivative of profit with respect to qantity so I can maximize profit:

That's as far as I got before the prof started going to fast and lost me. I know that I'm supposed to now find the profit of the manufacturer; which would be the demand multiplied by margin. So, would that be:

Profit(manufacturer) = since that would be demand (which I previously found times his margin)?

If that's true, then should I take the derivative of that? I don't know what to do... please help! Thanks