0

I have two functions:

f[x_] = 2 Cos[x]
g[x_] = -Sqrt[3]

I find the points of intersection.

sol = Solve[f[x] == g[x] && -2 Pi <= x <= 4 Pi, x]
pts = {x, f[x]} /. sol

I plot the two curves, the points, then I want to plot where the graph of f lies below the graph of g. I can fill the area between the curves:

Plot[{f[x], g[x]}, {x, -2 Pi, 4 Pi},
 Filling -> {1 -> {2}},
 Epilog -> {
   Red, PointSize[Medium], Point[pts]
   }]

But how can I fill the area between the curves only where the graph of f lies below the graph of g?

David
  • 14,883
  • 4
  • 44
  • 117

1 Answers1

3
Plot[{f[x], g[x]}, {x, -2 Pi, 4 Pi}, 
 Filling -> 1 -> {{2}, {LightBlue, White}}, 
 Epilog -> {Red, PointSize[Medium], Point[pts]}]

Mathematica graphics

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323