Equation Graph
generator.
Plot up to three functions of x and see every zero, peak and crossing as you type.
Graph
Drag the brass point along the curveGraph of sin(x) (teal), cos(x) (brass) for x from −2π to 2π, y from −1.16 to 1.16. sin(x) has 5 zeros and 4 turning points here. cos(x) has 4 zeros and 3 turning points here. The curves cross 4 times. The brass point traces sin(x) at x = 2.5, where y = 0.5985.
Rings mark zeros (teal), turning points (brass) and crossings (indigo). Labels are hidden when there are many; the key points table lists them all.
- Zeros of f₁
- 5
- Turning points of f₁
- 4
- Crossings
- 4
- f₁(0)
- 0
Between x = −2π and x = 2π, sin(x) meets the x-axis 5 times and turns 4 times (2 peaks, 2 dips). It meets the other curve at 4 points, the first at (−5.4978, 0.7071). At x = 2.5 it is above the x-axis.
Window
−2π to 2π is x from −6.2832 to 6.2832, y from −1.16 to 1.16.
Zeros, turning points and crossings
| Curve | |||
|---|---|---|---|
| Zero | −6.2832 | 0 | f₁ |
| Crossing | −5.4978 | 0.7071 | f₁ and f₂ |
| Zero | −4.7124 | 0 | f₂ |
| Local max | −4.7124 | 1 | f₁ |
| Zero | −3.1416 | 0 | f₁ |
| Local min | −3.1416 | −1 | f₂ |
How the zero near x = 3.14 was found
- 1Look either side of the point, one scan step (0.006283) awayf₁(3.135309) = 0.006283f₁(3.147876) = −0.006283
- 2The sign changes, so a zero lies between. Bisection halves that gap 80 timesx = 3.1416
- 3Check: put x back into f₁f₁(3.1416) = 0
- 4Zero(3.1416, 0)
Starts at x from and adds the step each row, up to 201 rows.
Table of values
| x | f₁(x) | f₂(x) | x in π |
|---|---|---|---|
| −6.2832 | 0 | 1 | −2π |
| −4.7124 | 1 | 0 | −1.5π |
| −3.1416 | 0 | −1 | −π |
| −1.5708 | −1 | 0 | −0.5π |
| 0 | 0 | 1 | 0 |
| 1.5708 | 1 | 0 | 0.5π |
| 3.1416 | 0 | −1 | π |
| 4.7124 | −1 | 0 | 1.5π |
| 6.2832 | 0 | 1 | 2π |
Values at a list of x
Type x values or paste a column from a spreadsheet. Each row gets the value of every function on the graph.
| # | x |
|---|---|
| 1 | |
| 2 | |
| 3 | |
| 4 |
Values for each x
| x | f₁(x) | f₂(x) |
|---|---|---|
| 0 | 0 | 1 |
| 0.5 | 0.4794 | 0.8776 |
| 1 | 0.8415 | 0.5403 |
| 2 | 0.9093 | −0.4161 |
Keyboard shortcuts
- Tab to the brass trace point, then ← and → move it along the curve. Shift moves it four times as far.
- Click the graph, then + zooms in, − zooms out and 0 resets the view.
- Ctrl or ⌘ with the mouse wheel zooms the graph.
- ↑ and ↓ in a number box move it one step: 1 in the window and table boxes, the slider step in the trace box. Hold Shift for ten steps or Alt for a tenth of a step.
- In the math field, typing sqrt, pi or ^ gives √, π and a power.
How it’s worked out
You type a rule y = f(x), and the tool works out y at hundreds of evenly spaced values of x across the graph. It joins those points into the curve. Where f(x) has no real value, such as ln(x) for x of 0 or less, it leaves a gap.
Zeros. A zero is an x where the curve meets the x-axis, so f(x) = 0. The tool splits the window into 2,000 equal steps and looks for a step where the sign of f flips. If f(a) and f(b) have opposite signs, the curve must cross zero between a and b:
It then tests the middle of that gap and keeps the half where the sign still flips. This is the bisection method, and each round halves the gap:
- a and b are the two ends of the gap, one step apart at the start.
- m is the midpoint. If f(m) has the same sign as f(a), m becomes the new a; if not, it becomes the new b.
After 80 rounds the gap is far smaller than any digit you can see. A sign flip only counts as a zero if f is close to 0 at the end, which throws out the jumps of tan(x) at its asymptotes.
Crossings. Two curves cross where f₁(x) = f₂(x). That is the same as asking where the gap between them is zero, so the tool runs the zero search on
Turning points. A sample that is higher than both neighbors marks a peak (a local maximum); lower than both marks a dip (a local minimum). Golden-section search then narrows each one down, much as bisection does for zeros.
The y range. When you leave it on Fit the curves, the window covers the middle 94% of the sampled y values (the 3rd to the 97th percentile) and stretches to the true top and bottom when they are not far beyond. A single huge value near an asymptote cannot squash the rest of the graph flat. For tan(x) on −2π to 2π the largest sample is about 1.6331 × 10¹⁶, yet the window runs from −11.04 to 11.04, so you still see the S-shaped branches.
Worked examples
Two signals a quarter turn apart
Lena is checking two AC signals in a lab, one shaped like sin(x) and one like cos(x), over two full cycles from −2π to 2π. She wants to know when they are equal.
The graph shows 4 crossings, at x = −5.4978, −2.3562, 0.7854, 3.927. Those are for whole numbers k. Every crossing sits at height ±0.7071, which is . At x = 2.5 the trace gives sin 2.5 = 0.5985 and cos 2.5 = −0.8011. Sine has 5 zeros in the window and cosine has 4.
A bakery’s break-even points
Omar sells cookies by the dozen. His weekly revenue for x dozen is −0.5x² + 30x dollars, because he has to drop the price to sell more. His costs are $160 a week plus $6 a dozen, so 6x + 160. He plots both for x from 0 to 50.
The curves cross at x = 8 and x = 40. Between those two points revenue is above cost, so he makes a profit. Below 8 dozen or above 40 dozen he loses money. Revenue peaks at x = 30 dozen with $450, where the cost line is at $340.
When coffee cools to 60 °C
Jess pours coffee at 90 °C in a 20 °C room. A simple cooling model gives its temperature after t minutes as 20 + 70e−0.05t. She wants to drink it at 60 °C, so she draws the flat line y = 60 as a second function, with x standing for t from 0 to 60.
The two curves cross at t = 11.19 minutes. The model starts at 90 °C and never reaches the room temperature, so the cooling curve has 0 zeros. After 10 minutes the trace shows 62.46 °C.
Reading your result
The big number is the selected function at the trace x. Drag the brass point, use the trace slider, or type an x to move it. If it says undefined, the rule has no real value there, for example √x for a negative x.
Zeros are the x-intercepts: where the curve meets the x-axis. Turning points are the local peaks and dips. A peak is a local maximum and a dip is a local minimum, as defined in Stewart's Precalculus, section 2.3. They are local because a higher or lower value may sit outside your window.
Crossings are the points both curves share. In a word problem they are usually the answer: break-even, the moment two prices match, or the time a quantity reaches a target you drew as a flat line.
The counts only cover your window. sin(x) has 5 zeros between −2π and 2π but infinitely many in all. Widen the window, or use Zoom out, to check for more.
Asymptotes. Where a curve shoots off to infinity, such as tan(x) at ±π/2, the search steps over the jump instead of counting it. On −π to π it lists 3 zeros (−3.1416, 0, 3.1416) and no turning points, because tan(x) rises all the way from one asymptote to the next; on −3.1 to 3.1 it finds the one real zero, 0.
Common mistakes
- Using degrees. The trig functions take radians. sin(30) gives −0.988, not 0.5. For degrees write sin(30π ÷ 180), which gives 0.5, and set x in plain numbers from 0 to 360.
- Losing a minus in a power. −x² means −(x²), which is never positive. If you mean (−x)², put the brackets in.
- Putting too much under a fraction. In the math field, typing / starts a stacked fraction, and everything you type next goes on the bottom. Typing 1/2x gives 1 over 2x, which is 0.125 at x = 4, not half of x (2). Press → after the 2 to leave the fraction, then type x.
- A window that is too narrow. x² − 10x + 21 has zeros at 3 and 7, so a window from −5 to 5 shows only one of them.
- Expecting a zero where the curve only touches. x² meets the x-axis at 0 without crossing it, so there is no sign change to find. The turning point list still shows the dip at (0, 0).
- Trying to graph a circle. x² + y² = 9 has two y values for each x, so it is not a function of x. Use the parametric curve grapher or the polar graph generator instead.
Questions people ask
Sources
- James Stewart, Lothar Redlin and Saleem Watson, Precalculus: Mathematics for Calculus, 7th ed., sections 2.2 (graphs of functions), 2.3 (local maxima and minima) and 5.3 (trigonometric graphs)
- Richard L. Burden and J. Douglas Faires, Numerical Analysis, 9th ed., section 2.1 (the bisection method)
- William H. Press et al., Numerical Recipes, 3rd ed., section 10.2 (golden section search)