Function grapher

Plot y = f(x), zoom in, trace points and find roots and intersections.

Functions
Line of f₁: solid
Line of f₂: dashed

Use x, + − × ÷ ^, brackets and sin, cos, tan, sqrt, cbrt, abs, ln, log, exp, floor… Angles in radians. 2x and 3(x+1) multiply.

Graph

Drag to move, scroll or pinch to zoom. With the graph focused: arrow keys move, + and − zoom, 0 resets.

Visible: x from -10 to 10

Trace

Trace position along x

f₁: x = 1, y = -1

Points in view

f₁(x) = x^2 - 2

Roots (y = 0)
x = -1.41421; x = 1.41421
y-intercept
(0, -2)
Turning points
min (0, -2)

f₂(x) = x

Roots (y = 0)
x = 0
y-intercept
(0, 0)
Turning points
none in view

Intersections

f₁ and f₂
(-1, -1); (2, 2)

Found numerically in the visible x range, shown to 6 significant digits.

What this tool does

Type a formula in x and the grapher draws y = f(x) at once. You can plot up to five functions together, each with its own colour and its own line style (solid, dashed, dotted, dash-dot, long dash), so the lines stay distinguishable in a black-and-white printout or for anyone who does not see colour well. Beside the graph it lists, for the part of the x axis you are looking at:

  • the roots of each function (where it crosses or touches y = 0),
  • the y-intercept f(0),
  • the turning points (local maximum and minimum),
  • the intersections of every pair of functions.

The default example plots x^2 - 2 and x. The list shows roots x = −1.41421 and 1.41421 (that is ±√2), the y-intercept and minimum at (0, −2), and the two intersections (−1, −1) and (2, 2), which are the solutions of x² − 2 = x.

The formula is read by the tool's own parser and turned into a small calculation tree; your text is never run as program code.

How to use it

  1. Type into f₁(x) =. Use + - * / ^, brackets, and the functions sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, sqrt, cbrt, abs, ln, log (base 10), exp, floor, ceil, round and sign, plus the constants pi (or π) and e.
  2. Add a function for up to five lines. A leading y = or f(x) = is ignored, so you can paste from a worksheet.
  3. Move and zoom. Drag the graph to move it; scroll the mouse wheel or pinch with two fingers to zoom around that point. With the graph focused, the arrow keys move it (Shift for bigger steps), + and − zoom, and 0 resets. The buttons above the graph do the same.
  4. Trace. Choose a function under Trace along and drag the slider, hover with the mouse or tap the graph: the exact coordinates appear below it.
  5. Save PNG downloads the current view on a white background with a legend, ready for a worksheet or slides.

How the formula is read

The rules are the same as in the scientific calculator, so a formula means the same thing on both pages:

  • Powers before multiplication, and powers group from the right: 2^3^2 is 2⁹ = 512.
  • A leading minus applies after the power: -x^2 is −(x²), a downward parabola. Write (-x)^2 for the other one.
  • Implied multiplication is ordinary multiplication: 2x, 3(x+1), x sin(x) and 2pi all multiply, left to right with × and ÷. So 1/2x is (1/2)·x, a straight line; write 1/(2x) for the hyperbola.
  • Functions need brackets (sin(x), not sin x) and angles are in radians: sin(x) crosses zero at 0, ±π ≈ ±3.14159, ±2π ≈ ±6.28319.
  • x^(1/3) is undefined for negative x, as in every programming language that follows IEEE 754; use cbrt(x) for the real cube root.

Where a function is undefined, such as sqrt(x) for x < 0 or ln(x) at 0, the graph simply has a gap.

Asymptotes, jumps and how points are found

The curve is sampled once per pixel column. Between two neighbouring samples the grapher checks whether the function really climbs steeply or jumps: it halves the interval repeatedly, and a continuous curve's change shrinks while a jump's does not. That is why tan(x) is drawn as separate branches with no false vertical line at x = ±π/2, and why floor(x) looks like stairs.

Roots are found where the sign changes between samples, then refined by bisection to about twelve significant digits. A sign change across a pole (tan at π/2) or a step is rejected because the function does not get close to zero there. A root where the curve only touches the axis, like x = 1 of (x-1)^2, has no sign change; it is found as a point where |f| has a minimum that reaches zero. Turning points are refined by searching for the place where the slope changes sign, so the minimum of x² − 2 is reported at exactly (0, −2) and the turning points of x^3 - 3x at (−1, 2) and (1, −2).

The results are numerical and limited to what you can see: zoom out to look for more roots, and remember that two roots closer together than a pixel-sized step may be reported as one. Results are shown to six significant digits. To solve the same equations exactly, with the steps written out, use the equation solver; for a reading guide to roots, intercepts and asymptotes, see how to read a function's graph.

Frequently asked questions

Why is -x^2 drawn as a downward parabola?

Because the power is applied before the minus sign, exactly as in algebra and in the scientific calculator: -x^2 means −(x²). At x = 3 it is −9. If you want (−x)², which is the same as x², write the brackets.

Are the angles in degrees or radians?

Radians, the convention for graphs of functions. sin(x) has roots at 0, ±π and ±2π (about ±3.14159 and ±6.28319). To graph a function of an angle in degrees, convert inside it: sin(x*pi/180).

How accurate are the roots and intersections?

Each root is refined by bisection to about twelve significant digits and shown to six. For x² − 2 the tool lists 1.41421, and the value behind it is 1.414213562373095. Only the visible x range is searched, and two roots closer than about one pixel apart can merge, so zoom in on crowded areas.

Why is there no vertical line at the asymptote of tan(x) or 1/x?

Between neighbouring points the grapher tests whether the function jumps or just rises steeply. Across a pole it jumps, so the line is broken there instead of joining +∞ to −∞ with a false vertical stroke. A sign change at a pole is also not reported as a root.

Why does x^(1/3) show nothing for negative x?

Raising a negative number to a non-integer power is undefined in real floating-point arithmetic, so the result is NaN and the graph has a gap. Use cbrt(x), which returns the real cube root, for example cbrt(-8) = −2.

Can I use the graph in homework or slides?

Yes. Save PNG exports the current view at twice the screen resolution on a white background, with a legend that shows each formula next to its line style.