# Define region between two curves

I'm trying to define the region between two curves, f[x] and g[x], I can easily find where they intersect:

f = Function[x, 12 x^2];

g = Function[x, 3 x^3];

p = {x, g[x]} /. DeleteDuplicates[Solve[g[x] == f[x], x, Reals]];

p1 = First[Take[p, 1]];

p2 = First[Drop[p, 1]];


From there I plot the curves:

plot = Plot[Evaluate@Through[{f, g}@x], {x, 0, 4},
PlotRange -> {{0, 4}, {0, 200}},
Epilog -> {Red, PointSize[0.02], Point@{p1, p2}},
PlotLabels -> Automatic]


And all of that works fine, my problem is when I try and define the intersection of those two regions

rf = ImplicitRegion[y <= f[x], {x, y}];

rg = ImplicitRegion[y >=  g[x], {x, y}];

intersection = RegionIntersection @@ {rf, rg};

Region[rf, PlotRange -> {{0, 4}, {0, 200}}]


Provide the coordinate bounds in the second argument of ImplicitRegion:

rf = ImplicitRegion[y <= f[x], {{x, 0, 4}, {y, 0, 200}}]

ImplicitRegion[y <= 12 x^2 && 0 <= x <= 4 && 0 <= y <= 200, {x, y}]

rg = ImplicitRegion[y >= g[x], {{x, 0, 4}, {y, 0, 200}}]

ImplicitRegion[y >= 3 x^3 && 0 <= x <= 4 && 0 <= y <= 200, {x, y}]

intersection = RegionIntersection @@ {rf, rg};

Region[#, AspectRatio -> 1] & /@ {rf, rg, intersection} RegionPlot gives a better picture:

RegionPlot /@ {rf, rg, intersection} RegionPlot[{rf, rg, intersection}] • Thank you so much, im always missing little details like that, I appreciate the time you put into your answer. – Wombles Apr 4 at 23:19
• @Wombles, my pleasure. Thank you for the accept. – kglr Apr 4 at 23:50
• @Wombles - Alternatively, use rf = ImplicitRegion[y <= f[x] && p[[1, 1]] <= x <= p[[2, 1]], {x, y}]; rg = ImplicitRegion[y >= g[x] && p[[1, 1]] <= x <= p[[2, 1]], {x, y}]; – Bob Hanlon Apr 5 at 3:23
• @BobHanlon, Thank you, i will give that a try as well! – Wombles Apr 5 at 5:07

Just a direct way to do:

ir = ImplicitRegion[g[x] < y < f[x], {{x, 0, 4}, {y, 0, 200}}];
ra = ImplicitRegion[y > f[x], {{x, 0, 4}, {y, 0, 200}}];
rb = ImplicitRegion[y < g[x], {{x, 0, 4}, {y, 0, 200}}];
rgns = {ir, ra, rb};
leg = First /@ rgns;
RegionPlot[{##}, PlotLegends -> leg] & @@ rgns 