Let x be the number of panels produced by the plant A. Then this plant produced 2% of x, that is, 0.02x defective panels. Plant B produced 800 - 0.02x defective panels or 3% of its total production. So, plant B produced (800 - 0.02x)/0.03 panels or x + 5000. We get the following equation:

(800 - 0.02x)/0.03 = x + 5000 multiply both sides by 0.03