Let Q1 and Q2 be the outputs of plants A and B. Solve the demand function for price and find total revenue:
P=100 - Q/4
TR = PQ = 100Q - Q²/4
TR = 100(Q1+Q2) - (Q1+Q2)²/4
Find total cost:
TC = 20Q1+0.5Q22
Profit = total revenue minus total cost:
Π = TR - TC = 100(Q1+Q2) - (Q1+Q2)²/4 - 20Q1 - 0.5Q22
Now take the partial derivatives and set them to zero to find the critical point(s):
Π1 = 100 - (Q1+Q2)/2 - 20 = 0
Π2 = 100 - (Q1+Q2)/2 - Q2 = 0
Solving these two equations gives only one critical point:
You can check that this critical point is indeed a maximum of the profit function by checking the 2nd partials:
Π11 = -1/2 < 0, Π22 = -3/2 < 0, Π11Π22
- Π122 = 1/2 > 0.
These are the conditions for a maximum.
Therefore, the total output of the two plants is Q=140+20=160, at a price of P=100-160/4=60.