How can I shade an region of a graph using the graph function?

1 Answer

Let's say I have the inequality #y>=x#. To show the boundary line, I can simply type "graph { x } " (no hashtags needed) and I'll get this:

graph{x}

To work with shading and multiple graphs, you need to change the format of what is graphed - essentially we add #y# terms to the graph, multiply the terms together (using brackets) and have the whole thing set to 0. And so with our example, I can write it as "graph { y-x=0 } " and get the same graph:

graph{y-x=0}

To shade, change the equal sign to an inequality. "graph { y-x>0 } " gives:

graph{y-x>0}

There are a number of existing answers that give more advanced tips on limiting graphs and shading, creating shaded shapes, and more. Here are a few:

https://socratic.org/questions/how-can-i-access-graph-package-for-illustrating-solutions-to-questions

https://socratic.org/questions/how-do-you-graph-two-or-more-functions-on-the-same-graph-with-the-graphing-utili

https://socratic.org/questions/useful-to-plot-points-on-socratic-graph