# Filling the area between three curves with the command Filling

Hi. I want to filling the are between the curves x^2, x and -x+1 from x=0 to x=a:=-1/2 + sqrt(5)/2. How can do this? Thanks.

• Please post the code in text form. Apr 25, 2023 at 23:29

Plot[{x^2, x, -x + 1, Min[x, 1 - x]}, {x, 0, 1},
PlotStyle -> {Automatic, Automatic, Automatic, None},
Filling -> {4 -> {{1}, {None, Automatic}}}]


Plot[{x^2, x, -x + 1}, {x, 0, 1}, Filling -> {1 -> {{3}, {Automatic, None}}}]


You can replace Automatic with whatever directive you want.

## Update

Missed that the desire was to highlight the area between all three. Here's one approach:

Plot[{x^2, x, -x + 1}, {x, 0, 1},
Filling -> {1 -> {{3}, {Automatic, None}}, 2 -> {{3}, {White, None}}}]


It's a bit hacky, in that it assumes the background to be white, but it avoids introducing extra functions.

• But I don't want the top to be painted. I only want the part enclosed by the three curves. Apr 25, 2023 at 19:50
• Oh, sorry, I didn't see the little x. I read it as between the curves x^2 and -x+1. Others have already posted answers. Apr 25, 2023 at 20:15
• I posted a slightly different way to solve it. Apr 25, 2023 at 20:19
Clear["Global*"]


An alternative to using Filling

Show[
RegionPlot[
Tooltip[y < x && y < 1 - x && y > x^2 && 0 < x < 1],
{x, 0, 1}, {y, 0, 1},
PlotPoints -> 25,
MaxRecursion -> 5,
FrameLabel -> (Style[#, 14] & /@ {"x", "y"})],
Plot[Evaluate[
Tooltip /@ {x^2, x, -x + 1}], {x, 0, 1},
PlotLegends -> Placed["Expressions", {.5, .8}]]]
`