AI Glossary / Graphs and symbolic AI / Beginner
Graph of a function
Definition
The graph of a function is the set of all input-output pairs produced by that function over its specified domain. For a function f from a set X to a set Y, its graph is {(x, f(x)): x belongs to X}. A familiar curve on coordinate axes is one way to display this mathematical object.
What it means
Every allowed input contributes exactly one output, although different inputs may share an output. The graph records which pairs belong to the function. Its meaning therefore depends on both the rule and the domain: the same formula can describe different graphs when the permitted inputs change.
This use of graph differs from a network of nodes and edges. A plotted prediction curve is a function graph; a network of connected customers is a relational graph. Both appear in AI, so identify which meaning is intended. A function graph also exists when the input or output has too many dimensions for a simple drawing.
How it works
Choose the input domain and evaluate the function at each input conceptually. Collect the resulting ordered pairs. For a real-valued function of one real variable, plot input horizontally and output vertically. For a real-valued function of two variables, the graph may be drawn as a surface in three-dimensional space.
A computer display usually evaluates only a finite set of points and connects or interpolates them. The mathematical graph can contain infinitely many points, so the rendered picture is an approximation. Sampling choices, axis scales, and discontinuities can affect what a viewer sees without changing the underlying function.
Three practical examples
- A teacher plots a simple prediction rule to show how its output changes with one input feature.
- An analyst displays a loss function against a single adjustable parameter to explain where smaller values occur.
- A designer compares two deterministic scoring functions over the same permitted input range, making their different responses visible.
Think of it this way
Think of the graph as a complete pairing ledger: every permitted input has its associated output written beside it. A coordinate plot arranges those ledger entries spatially. The analogy is limited because a function may have infinitely many inputs or multidimensional outputs, and no finite printed ledger or screen can necessarily display every pair.
Worked example
Let f(x) = x squared, with domain X = {-2, -1, 0, 1, 2}. Its graph contains exactly five pairs: (-2, 4), (-1, 1), (0, 0), (1, 1), and (2, 4). On this domain, the graph consists of five separate points. Drawing a continuous parabola would add input-output pairs that are not in this particular function's graph.
Now change the domain to all real numbers. The same formula gives a continuous parabola containing the original five points and infinitely many others, including (0.5, 0.25). The changed domain has changed the graph.
Finally, reverse the five original pairs to consider an inverse relation. Output 4 is paired with both -2 and 2, so that inverse relation is not a function of the original output. Restricting the original domain to {0, 1, 2} removes this ambiguity: the reversed pairs become (0, 0), (1, 1), and (4, 2). This illustrates why a function need not automatically have an inverse function on its full domain.
Illustrative case study
In a fictional training project, Maple Tutors prepares a chart for a rule that accepts only whole-number package counts from zero through five. An early drawing joins the evaluated points with a smooth line, suggesting fractional package counts are permitted.
The editor switches to individual points and labels the allowed domain. A separate example uses a genuinely continuous input to explain when a connected curve is appropriate. The invented case shows how a faithful visualization depends on the mathematical definition, rather than on whether a smooth chart looks more polished.
Common misconceptions and mistakes
The graph of a function is not simply any curve drawn on axes. With the input on the horizontal axis, a function of one real variable cannot assign two distinct vertical values to the same input. A circle therefore does not represent one such function over its entire horizontal extent without choosing a branch.
Do not confuse the graph with the epigraph, which includes points on or above a real-valued function. A graph also does not establish causation, provide uncertainty intervals, or prove that a fitted model will predict new cases accurately. Those require additional definitions, evidence, or analysis.
Business use
Function graphs help explain prediction rules, objective functions, response curves, and parameter effects. They make a model's behavior easier to inspect when the number of displayed dimensions is manageable. A chart can reveal nonlinear responses or a sharp threshold that would be harder to understand from a formula alone.
For a business audience, label units, domain, and any fixed inputs. If a many-feature model is shown against one feature, explain how the other features were handled. Otherwise, a slice through a complicated function can be mistaken for the model's complete behavior across all possible cases.
People also ask
Can two inputs have the same output?
Yes. The squared function assigns both -2 and 2 the output 4; this does not violate the definition of a function.
Does every function graph look like a smooth curve?
No. It may consist of discrete points, have jumps, or involve dimensions that are difficult to visualize.
Is a plot of observed data automatically a function graph?
No. Observations may include repeated inputs with different outputs. A fitted function is a separate mathematical object defined from or alongside those observations.
Check your understanding
For f(x) = x squared with domain {-2, -1, 0, 1, 2}, is (0.5, 0.25) part of the graph?
Answer: No. The formula gives that output at 0.5, but 0.5 is outside the specified domain. Both the formula and the permitted inputs determine membership.
Related terms
Learn next
Study the difference between a function's range and codomain, then compare a graph with an epigraph. Plot the same formula once on a finite domain and once on an interval. Label the domain explicitly and explain which points belong in each drawing.
More in Graphs and symbolic AI
- Graph Convolutional Network - A Graph Convolutional Network, or GCN, is a neural-network architecture that learns representations using a graph's connections together with features...
- Graph Convolutional Policy Network - Graph Convolutional Policy Network, or GCPN, is a model introduced for goal-directed graph generation using reinforcement learning.
- Graph Hashing - Graph hashing converts a graph's selected structural and attribute information into a compact identifier.
- Graph search - Graph search is a family of problem-solving procedures that explore states and transitions while accounting for states reached more than once.
- Graphical degree sequence - A graphical degree sequence is a list of nonnegative integers that can be realized as the node degrees of a graph of the specified kind.
- Graphplan - Graphplan is an automated planning algorithm developed by Avrim Blum and Merrick Furst.
Sources
Sources: Aalto Dictionary of Machine Learning, graph of a function: https://aaltodictionaryofml.github.io/ADictML_Main.pdf Boyd and Vandenberghe, Convex Optimization lecture slides, functions and epigraphs: https://web.stanford.edu/~boyd/cvxbook/bv_cvxslides.pdf
Previous: Graph neural network Next: Graph partitioning