Real-life application of Calculus
I am currently doing some real-life applications for calculus and stumbled upon the following question, can anyone please help me?
When a chemical factory produces a certain compound they have observed that the daily amount y of defective compounds depends on the total amount x that they produce according to the empirical formula:
y = 0.02x + 0.00005x^2
where x and y are measured in kilograms. The manufacturer earns $100 per kilogram of nondefective compound and incurs a loss of $20 per kilogram of defective compound.
(a) Write down a function for the total profit P(x).
(b) How many kilograms should they produce to maximise their profits?
Any help is much appreciated,