Tangent line — The straight line that touches f at the single point P=(c,f(c)) with the same slope as the curve at that point: slope =f′(c).
Slope of the tangent — Equal to the derivative f′(c). This is the geometric meaning of the derivative.
Point-slope form — The standard equation: y−f(c)=f′(c)(x−c), or equivalently y=f(c)+f′(c)(x−c).
Linearization — Another name for the tangent line equation written as a function: L(x)=f(c)+f′(c)(x−c). It is the best linear approximation of f near c.
Critical point — A point where f′(c)=0 (horizontal tangent) or where f′ is undefined. Candidates for local maxima and minima.
This widget uses the cubic f(x)=31x3−x, whose derivative is f′(x)=x2−1. Horizontal tangents sit at x=±1.
Getting Started
The visualizer shows the cubic f(x)=31x3−x with a draggable point c on the x-axis. P=(c,f(c)) lifts vertically from c to the curve, and the tangent line through P extends in both directions with slope f′(c).
Drag c left or right to move the point along the x-axis. The dashed drop line, the highlighted P, and the tangent line all update in real time, along with the live readouts below the canvas: c, f(c), f′(c), and the tangent slope.
For a guided walkthrough, click one of the four scenario buttons at the bottom: Positive slope, Negative slope, Local max, or Local min. Each runs a six-step animation explaining what the tangent at that c tells you about the curve.
The Reset button clears the active scenario and returns c to its default position.
Drag Mode vs Scenario Mode
Two interaction styles share the same canvas.
Free drag — Grab the c marker on the x-axis and slide it anywhere in the visible range. The tangent line pivots in real time as the slope f′(c)=c2−1 changes. This is the fastest way to feel how the tangent rotates: drag through c=−1 or c=1 and watch the tangent flatten exactly at the critical points where f′=0.
Scenario animation — Click any of the four scenario buttons to lock c to a specific value and play the six-step explanation. The full color theme of the visualizer changes to match: blue for positive slope, red for negative slope, amber for the local max, teal for the local min.
Starting a scenario interrupts dragging. Once an animation completes, you can still drag c — doing so clears the scenario tint and returns the visualizer to neutral.
Free drag, frozen at c = -0.5
No scenario is running - this is the widget at its default point of tangency. P sits at (-0.5, 0.46) and the slope readout gives f′(-0.5) = -0.75, so the tangent already leans downhill. Drag c anywhere and this same picture redraws with a new slope.
Running the Four Scenarios
Positive slope sets c=−1.7, where f′(−1.7)=1.89>0. The tangent line tilts upward to the right, matching the curve's ascending behavior on the left wing of the cubic.
Negative slope sets c=0.4, where f′(0.4)=−0.84<0. The tangent line tilts downward to the right, matching the curve's descending behavior across the middle interval between the local max and local min.
Local max sets c=−1, where f′(−1)=0. The tangent line is horizontal, parallel to the x-axis. Chevron arrows on the curve show the slope flipping from positive on the left to negative on the right — the signature of a local maximum.
Local min sets c=1, where f′(1)=0. The tangent line is horizontal. Chevron arrows show the slope flipping from negative on the left to positive on the right — the signature of a local minimum.
Each scenario takes a few seconds across the six animation phases.
Positive Slope: the Tangent Rises
The Positive slope scenario locks c=−1.7, out on the left wing of the cubic. The slope there is f′(−1.7)=(−1.7)2−1=1.89, a positive number, so the tangent line tilts upward as you read it left to right.
The shaded band covers the interval the scenario is talking about — the stretch left of the local maximum, where the curve is climbing. A tangent drawn at any c inside that band leans the same way, because f′(x)=x2−1 stays positive for every x<−1.
Positive slope, frozen at c = -1.7
The tangent through P = (-1.7, 0.06) carries slope 1.89. Curve and line both climb to the right, and inside the shaded band every other tangent would climb as well.
The general statement behind the picture: f′(c)>0 means f is increasing at c. The tangent makes that visible, because the sign of the slope of a line is exactly the direction it travels.
Notice how far apart the tangent and the curve drift near the edges of the canvas. The agreement between them is local — they share the point P and the slope at P, and nothing beyond that is promised. The cubic bends away; the line cannot.
Reverse the sign and you get the negative slope case, where the same reasoning runs downhill.
Negative Slope: the Tangent Falls
The Negative slope scenario locks c=0.4, inside the middle interval between the two extrema. The slope is f′(0.4)=0.42−1=−0.84, a negative number, so the tangent line tilts downward to the right.
The shaded band here runs from −1 to 1 — exactly the interval where x2<1, and therefore where f′(x)=x2−1 is negative. This is the descending stretch of the cubic, the run from the local maximum down to the local minimum.
Negative slope, frozen at c = 0.4
The tangent through P = (0.4, -0.38) carries slope -0.84. The band spans (-1, 1), the whole interval on which the cubic descends from its peak to its valley.
The mirror of the previous case: f′(c)<0 means f is decreasing at c. Nothing about the argument changes except the sign.
The two bands together account for all of the curve's direction. Outside [−1,1] the slope is positive and the curve rises; inside, the slope is negative and it falls. The boundaries between those regimes are the two points where the slope passes through zero — the local maximum and the local minimum.
Horizontal Tangent at the Local Maximum
The Local max scenario locks c=−1, the left boundary between the rising and falling regions. The slope is f′(−1)=(−1)2−1=0, so the tangent line is horizontal — perfectly parallel to the x-axis.
Chevron arrows appear along the curve on both sides of c. To the left they point uphill, to the right they point downhill. That flip from positive to negative slope across c is the signature of a local maximum, and the flat tangent sits exactly at the turning point.
Local maximum, frozen at c = -1
Slope 0: the tangent is a horizontal line through P = (-1, 0.67), the peak of the curve. The chevrons point uphill on the left and downhill on the right - the sign change that confirms a maximum.
The direction that always holds is Fermat's theorem: if f has a local extremum at an interior point c and f′(c) exists, then f′(c)=0. A smooth peak forces a horizontal tangent.
The converse fails, which is why the panel calls the flat tangent necessary but not sufficient. A horizontal tangent only says the curve is momentarily flat; f(x)=x3 has one at the origin and no extremum there at all. What certifies the maximum is the sign change of f′ — positive before c, negative after — and that is precisely what the chevrons draw. The same test applied in the other order classifies the local minimum, and the full procedure is set out under horizontal tangents and critical points.
Horizontal Tangent at the Local Minimum
The Local min scenario locks c=1, the right boundary of the descending interval. Again f′(1)=12−1=0, so the tangent is horizontal.
The chevrons run the other way this time: downhill on the left of c, uphill on the right. The slope changes from negative to positive, which is the signature of a local minimum.
Local minimum, frozen at c = 1
Slope 0 again, this time through P = (1, -0.67) at the bottom of the valley. The chevrons run downhill then uphill - the reversed sign change that confirms a minimum.
Both extrema of this cubic are found the same way: solve f′(c)=0, which for f′(x)=x2−1 gives c=±1. Those two values are the complete set of critical points, and the scenarios visit them one each.
Comparing the two flat tangents side by side is the fastest way to see that zero slope by itself carries no verdict. The tangent at c=−1 and the tangent at c=1 are both horizontal lines; only the behavior of f′ around them tells the peak from the valley.
Following the 6-Step Animation
Each scenario plays the same six phases, labeled in a banner at the top of the canvas:
Step 1 — Identify the region near c. A shaded band highlights the interval the analysis covers.
Step 2 — Mark the point c on the x-axis. The marker animates into position from wherever it was previously.
Step 3 — Lift to the curve: P=(c,f(c)). A dashed drop line connects c on the axis to P on the curve.
Step 4 — Evaluate the slope f′(c). The Computation tab highlights the substitution f′(c)=c2−1.
Step 5 — Draw the tangent through P with slope f′(c). The tangent line extends outward from P, and a floating label shows the numerical slope value.
Step 6 — Write the tangent equation: y=f(c)+f′(c)(x−c). The Computation tab displays the equation with the numerical values substituted in.
When the animation finishes, the right-side panel switches automatically to the Meaning tab.
Using the Computation Tab
The Computation tab walks through the tangent line construction algebraically, with the active step highlighted in the scenario color.
The point of tangency — Shows the current values of c and f(c). These are the coordinates of P.
Step 1 — Slope from the derivative — Substitutes c into f′(x)=x2−1 to give the numerical slope f′(c). The colored result is the slope of the tangent.
Step 2 — Point-slope form — Plugs c, f(c), and f′(c) into the formula y−f(c)=f′(c)(x−c). The expanded slope-intercept form y=mx+b is shown directly below, with b computed from f(c)−f′(c)⋅c.
You can switch to Computation at any time during free drag — the displayed equation always reflects the current c, so it updates as you move the marker.
Using the Meaning and Theory Tabs
Meaning explains what the current tangent reveals about the curve, with a verdict card themed to the active scenario. Positive and negative slope cards describe the curve's direction at c; max and min cards highlight the horizontal tangent and the connection to Fermat's theorem. A "why" note adds context — for example, clarifying that a horizontal tangent alone is necessary but not sufficient for a maximum or minimum. The Meaning tab opens automatically when a scenario animation finishes.
Theory provides the formal background in five blocks: the definition of the tangent line and its point-slope equation, the derivative as the slope of the tangent, the tangent as the best linear approximation (linearization), horizontal tangents and critical points (including Fermat's theorem), and a worked breakdown of how the slope f′(c)=c2−1 behaves across the specific cubic used in this widget.
Switch tabs at any time without interrupting the canvas.
What is a Tangent Line?
A tangent line to a function f at x=c is the unique straight line that passes through P=(c,f(c)) and matches the curve's direction at P. "Matches the direction" is made precise by the slope: the tangent has slope equal to f′(c), the derivative of f evaluated at c.
The defining equation in point-slope form is:
y−f(c)=f′(c)(x−c)
Or equivalently:
y=f(c)+f′(c)(x−c)
This is the best linear approximation of f near c. Any other line through P would diverge from f faster as x moves away from c, because it would have the wrong slope. The tangent shares both the value and the first derivative of f at c.
For a deeper treatment with proofs and worked examples, see the tangent line theory page.
Derivative as Slope and the Point-Slope Form
The derivative f′(c) is defined geometrically as the slope of the tangent line at c. Algebraically, it is the limit of secant slopes:
f′(c)=limh→0hf(c+h)−f(c)
Each secant is a chord of f passing through (c,f(c)) and a nearby point (c+h,f(c+h)). As h shrinks toward zero, those secants rotate toward a single limiting line — the tangent at c. Its slope is f′(c).
To write the tangent equation, you only need two pieces of information: a point on the line and its slope. The point is (c,f(c)), the slope is f′(c), and point-slope form is the standard way to combine them:
y−f(c)=f′(c)(x−c)
The same line can also be written as the linearizationL(x)=f(c)+f′(c)(x−c) — a useful viewpoint for approximation and Taylor series.
Horizontal Tangents and Critical Points
When f′(c)=0, the tangent line at c is horizontal. Such a point is called a critical point of f.
Critical points are candidates for local maxima and local minima. Fermat's theorem guarantees the connection in the other direction: if f has a local extremum at an interior point c where f′ exists, then f′(c)=0. So every smooth interior extremum has a horizontal tangent.
The reverse is not automatic. A horizontal tangent alone only says that the curve is momentarily flat at c. It might be a local maximum, a local minimum, or an inflection point with a flat tangent. Examples:
f(x)=−x2 has a horizontal tangent at 0, and it is a local maximum
f(x)=x2 has a horizontal tangent at 0, and it is a local minimum
f(x)=x3 has a horizontal tangent at 0, but no extremum — 0 is an inflection point with a flat tangent
To classify a critical point, examine the sign change of f′ across c or use the second derivative test. See the critical points page for the full procedure.
Related Concepts
Derivative — The fundamental operation: rate of change of f at a point, defined as the limit of secant slopes.
Average rate of change — The slope of a secant line over an interval; the discrete cousin of f′(c).
Linearization — The tangent line viewed as a function L(x)=f(c)+f′(c)(x−c), used for approximation.
Critical points — Where f′(c)=0 or is undefined; the starting set for finding extrema.
First derivative test — Sign analysis of f′ to classify critical points as maxima, minima, or neither.
Inflection points — Points where the second derivative changes sign and the tangent crosses the curve.
Newton's method — Numerical root-finding algorithm that iteratively follows tangent lines back to the x-axis.
Taylor series — Higher-order generalization of linearization, using all derivatives at c.