I was practising calculus where I got this question:
The operating cost of a truck is $12 + \frac{x}{6}$ per km, when the truck travels x km/hour. If the driver earns 6 Rs. per hour, what is the most economical speed to operate the truck on a 400 km road? Also due to construction, the truck can travel only between 35 and 60 km/hour.
My approach:
$OP = \left(12 + \frac{x}{6}\right)400$
$DE = \frac{400}{x}*6 = \left(\frac{6}{x}\right)400$
Net Profit = Net Earnings - Operating Cost of Truck
Thus,
$P = DE - OP$
$P = 400\left(\frac{6}{x} - 12 - \frac{x}{6}\right)$
Differentiating w.r.t x,
$P' = 400\left(\frac{-6}{x^2} - \frac{1}{6}\right)$
Equating this to $0$, x has no solution(s). Where am I going wrong?
P.S = I think the question might be slightly wrong as the operating cost should be in paisa (1 Rupee = 100 paisa). But in the book, there is no mention of that.
All your equations are correct: you ended up with a net profit of $$P(x) = 400\left( \frac{6}{x} - 12 - \frac{x}{6} \right)$$
We now want to find the absolute maximum of this in the range $35 \le x \le 60$.
You also found that $$\frac{d}{dx}P = 400\left( -\frac{6}{x^2} - \frac{1}{6} \right)$$
This is always negative, so $P$ is decreasing everywhere it is defined. In general, when finding absolute extrema in an interval, you must check the critical points and end points of the interval.
Because there are no real critical points (as you realized), all that remains is to check $x = 35$ km/hour and $x = 60$ km/hour. It is clear that $x = 35$ km/hour maximizes the profit because $P$ is decreasing (or because $P(35)>P(60)$).
Specifically, with $x = 35$ km/hour, the profit will be $$400\left( \frac{6}{35} - 12 - \frac{35}{6} \right) \approx −7064.762$$
which is a loss, in fact.