# Shade where a function f lies below a function g [duplicate]

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?

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


• Is this one of those methods that is still undocumented? – David Oct 8 '15 at 22:20
• No, it is in the documentation under the Details section of Filling (last entry in the first table you encounter there). – Sjoerd C. de Vries Oct 8 '15 at 22:24
• @SjoercC.deVries Got it. Thanks for the reference. – David Oct 9 '15 at 0:16