# How to find critical points of trig function over an interval?

I need to find the critical points (maxima, minima and points of inflection) of the function $f(x)= \sin(x)+\ln(\frac{1}{4}x^2-\frac{1}{4}x+\frac{3}{2})$ over the interval $-3\leq x\leq5$.

To do this I need to find all values x such that $f'(x)=0$ or $f'(x)$ does not exist.

How can this be done in MMA? (N)Solve and Reduce don't seem to work.

This is for an introductory Calculus course so please don't tell me the answer, just how to find it. Thanks.

• plot graphic of the function or of it's drivative and use FindRoot near the suspicious points to find them precisely
– k_v
Apr 3 '15 at 16:45

## 2 Answers

Note a critical point of $f(x)$ must also lie in it's domain. So for example $x = 0$ is not a critical point of $f(x) = 1/x$, even though $f'(0)$ doesn't exist.

We can exploit the M10 function FunctionDomain.

RealD[f_, x_] := Assuming[x ∈ Reals, FunctionExpand@D[f, x]]

CriticalPoints[f_, x_] := CriticalPoints[f, {x, -∞, ∞}]

CriticalPoints[f_, {x_, a_, b_}] :=
Reduce[RealD[f, x] == 0 && a <= x <= b, x, Reals] ||
Reduce[FunctionDomain[f, x, Method -> {Reduce -> False}] &&
!FunctionDomain[RealD[f, x], x, Method -> {Reduce -> False}] &&
a <= x <= b, x, Reals]


I didn't test this code too much, so maybe it needs improvement. Here are some examples:

CriticalPoints[Sin[x] + Log[x^2/4 - x/4 + 3/2], {x, -3, 5}] // N

x == -1.169 || x == 1.94892 || x == 4.32773

CriticalPoints[Abs[x], x]

x == 0

CriticalPoints[1/x, x]

False


Reduce don't work because there are infinite x which satisfy f'[x]==0. If you add the range of x, it will give the answer, like this

Reduce[f'[x] == 0 && -3 <= x <= 5, x]