1
$\begingroup$

Im having a hard time finding the intervals where the function: f[x_] := x^2 - 4x + 7 Cos[x] is increasing and decreasing using mathematica. I tried using FindRoot but it's not too accurate because the curve has inflection points beyond just the zeroes.enter image description here

I did this so far, which is wrong. I'm trying to find where it increases and decreases on the interval $[-4,4]$

$\endgroup$
3
  • $\begingroup$ What have you tried so far? $\endgroup$
    – MarcoB
    Commented Mar 30, 2021 at 21:51
  • $\begingroup$ I just added an image of what i did so far $\endgroup$ Commented Mar 30, 2021 at 22:04
  • $\begingroup$ If all that's provided is an image of code, then people cannot copy/paste the code and must rewrite from scratch if they wish to provide assistance. $\endgroup$ Commented Mar 31, 2021 at 14:33

1 Answer 1

2
$\begingroup$

Taking h[x_] := x^2 - 4x + 7 Cos[x], you can find all roots of h' in the interval $[-4,4]$ with

Solve[h'[x] == 0 && -4 <= x <= 4, x]

However, you can get the intervals where h is increasing and decreasing directly as inequalities with Reduce:

increasing = Reduce[h'[x] > 0 && -4 <= x <= 4, x]
decreasing = Reduce[h'[x] < 0 && -4 <= x <= 4, x]

You can also generalize to outside of the interval $[-4,4]$:

allincreasing = Reduce[h'[x] > 0, x]
alldecreasing = Reduce[h'[x] < 0, x]

If you'd like the numeric forms of the roots, simply apply N, e.g. N @ increasing.

$\endgroup$
3
  • $\begingroup$ Thank you so so much! $\endgroup$ Commented Mar 30, 2021 at 23:19
  • $\begingroup$ Would you know how to find the intervals of concavity of the same function? $\endgroup$ Commented Mar 30, 2021 at 23:29
  • $\begingroup$ Same thing, just use h'' instead of h'—"concavity" is exactly whether the derivative is increasing or decreasing, so you just repeat the procedure with the derivative of the derivative! $\endgroup$
    – thorimur
    Commented Mar 30, 2021 at 23:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.