CalculatorSignAll calculators

Piecewise Line and Breakpoint Graph Calculator

Graph a continuous two-part line with separate slopes and calculate the output at a chosen x on either side of its breakpoint.

Piecewise Line and Breakpoint Graph Calculator

Result
—

Use this calculator on your site

Paste the full code, including the CalculatorSign credit, into a Custom HTML block on your site.

Preview widget

Graph a line whose slope changes at one point. Enter the breakpoint's x and y coordinates, the slope before that point and the slope after it. The chart uses both rules over the x range you select. Enter an extra x value to calculate its corresponding y and see whether it falls before, at or after the breakpoint.

This form describes a continuous piecewise line. Both parts pass through the breakpoint, so the graph changes direction or steepness without a jump in value. Use it for a relationship that starts with one rate and switches to another while preserving the amount already accumulated.

Build the two formulas from one shared point

Each piece starts its calculation at the same coordinate. Subtract the breakpoint x from the x you want to evaluate. Multiply that difference by the slope for the relevant side and add the result to the breakpoint y. For an x below the breakpoint, the horizontal difference is negative and the calculator uses the left-hand slope.

For an x above the breakpoint, it uses the right-hand slope with the same starting y. At the breakpoint, the horizontal difference is zero, so the outcome is the shared y either way. This ensures the two expressions agree at the boundary even when their slopes have opposite signs.

The slopes tell you the change in y for every unit of x. A positive slope rises as x increases. A negative slope falls, and a zero slope remains level. If both slopes are identical, the relationship becomes a straight line over the entire displayed range. The breakpoint still serves as the reference coordinate for the formulas.

Worked graph with a peak at the breakpoint

Enter a breakpoint at (2, 5), a left slope of 1.5 and a right slope of negative 0.75. View x from negative four to eight. To evaluate the function at x equal to six, use the right piece. The horizontal difference from the breakpoint is four. Multiply four by negative 0.75 to get negative three, then add five. The result is y equal to two.

For a check on the other side, enter x equal to zero. Moving from the breakpoint x of two to zero is a change of negative two. The left-hand slope is 1.5, so the y change is negative three and the result is again two. The two locations have matching y values in this example even though they are different distances from the breakpoint.

The plotted line rises toward the breakpoint from the left and falls to its right. At exactly x equal to two, the result is five. That is the highest value within the displayed window for these two slopes. Choosing slopes that are both positive would instead give a line that continues rising after the breakpoint, potentially at a different rate.

Choose a viewing range that shows the change

The first and last x values control the chart window and do not change the formulas. Place the breakpoint between those values if you want to see both segments. If the selected x range is entirely on one side, the visible graph is a single straight piece, while the value lookup can still evaluate a point outside the window.

The vertical axis scales to cover the values present in the chosen window. A wide x span may make a small change near the breakpoint difficult to see because extreme values stretch the chart scale. Try a closer range around the breakpoint when you need to inspect its position. The exact query result remains available even if the line is difficult to judge by eye.

A continuous two-rate graph can represent a cumulative tariff or charge when the first rate applies to units up to a cutoff and the second rate applies to later units. The y value at the cutoff already contains any earlier amount. If the price jumps at the cutoff because a new fee applies all at once, the continuous form will not represent that jump. The graph is designed around a common boundary value.

Choose consistent units for the two slopes. For example, if x records hours and y records liters, use liters per hour for both sides. The breakpoint y and the query y then also use liters. Keep the units beside the numbers when recording a projection.

Frequently asked questions

Can I evaluate a point outside the visible graph?

The query uses the entered rule even if its x value lies outside the plot window. Change the displayed endpoints if you want that point to fall within the visible part of the line.

What happens when one slope is zero?

That piece is horizontal. Its y value stays equal to the shared breakpoint height throughout that side of the graph.

Does the graph accept more than one breakpoint?

The inputs define two pieces meeting at a single location. More than one change in slope requires extra pieces and a different function definition.

Are the two lines allowed to be disconnected?

Both pieces are anchored to the same y at the shared x. That gives a connected line and lets the graph show a rate change without a discontinuity.