Piecewise Function Evaluator Calculator
Free Piecewise function evaluator Calculator for algebra. Enter values to get step-by-step solutions with formulas and graphs.
Calculator
Adjust values & calculateValue Table
Formula
A piecewise function uses different formulas for different intervals of the domain. The breakpoint c divides the domain into regions where different rules apply. Continuity requires g(c) = h(c). Differentiability additionally requires the slopes to match at the breakpoint.
Last reviewed: December 2025
Worked Examples
Example 1: Evaluating a Piecewise Function at Multiple Points
Example 2: Checking Continuity of a Piecewise Function
Background & Theory
The Piecewise Function Evaluator applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.
History
The history behind the Piecewise Function Evaluator traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.
Frequently Asked Questions
Sources & References
Formula
f(x) = { g(x) if x < c, h(x) if x >= c }
A piecewise function uses different formulas for different intervals of the domain. The breakpoint c divides the domain into regions where different rules apply. Continuity requires g(c) = h(c). Differentiability additionally requires the slopes to match at the breakpoint.
Worked Examples
Example 1: Evaluating a Piecewise Function at Multiple Points
Problem: Given f(x) = 3x + 1 for x < 2 and f(x) = -2x + 9 for x >= 2, evaluate f(-1), f(2), and f(5).
Solution: f(-1): Since -1 < 2, use left piece: f(-1) = 3(-1) + 1 = -2\nf(2): Since 2 >= 2, use right piece: f(2) = -2(2) + 9 = 5\nf(5): Since 5 >= 2, use right piece: f(5) = -2(5) + 9 = -1\n\nContinuity check at x = 2:\nLeft limit: 3(2) + 1 = 7\nRight value: -2(2) + 9 = 5\n7 does not equal 5, so there is a jump discontinuity of size 2.
Result: f(-1) = -2 | f(2) = 5 | f(5) = -1 | Jump discontinuity at x = 2
Example 2: Checking Continuity of a Piecewise Function
Problem: Is f(x) = 2x + 1 for x <= 3 and f(x) = -x + 10 for x > 3 continuous at x = 3?
Solution: Left limit (as x approaches 3 from left):\nlim = 2(3) + 1 = 7\n\nRight limit (as x approaches 3 from right):\nlim = -(3) + 10 = 7\n\nFunction value at x = 3 (left piece applies since x <= 3):\nf(3) = 2(3) + 1 = 7\n\nAll three values equal 7.\n\nDifferentiability: Left slope = 2, Right slope = -1\nSlopes differ, so the function has a corner (not differentiable) at x = 3.
Result: Continuous at x = 3 (f(3) = 7) | Not differentiable (corner point)
Frequently Asked Questions
What is a piecewise function and when is it used?
A piecewise function is a function defined by different formulas or rules for different parts of its domain. Instead of using a single expression for all inputs, the function switches between two or more expressions depending on where the input falls. For example, the absolute value function |x| is piecewise: it equals x when x >= 0 and -x when x < 0. Piecewise functions are used extensively in real-world modeling because many phenomena behave differently under different conditions. Tax brackets, shipping rates, overtime pay, and cell phone plans all use piecewise pricing. In engineering, stress-strain relationships are piecewise because materials behave differently before and after their yield point.
How do you evaluate a piecewise function at a specific point?
To evaluate a piecewise function at a specific x value, first determine which piece of the function applies by checking which condition the x value satisfies. Then substitute the x value into the corresponding formula. For example, given f(x) = 2x + 1 if x < 3 and f(x) = x^2 - 2 if x >= 3, to find f(5): since 5 >= 3, use the second piece: f(5) = 5^2 - 2 = 23. To find f(1): since 1 < 3, use the first piece: f(1) = 2(1) + 1 = 3. At the breakpoint x = 3: since 3 >= 3, use the second piece: f(3) = 9 - 2 = 7. Always pay careful attention to whether the breakpoint uses strict or non-strict inequalities.
What does it mean for a piecewise function to be continuous?
A piecewise function is continuous at a breakpoint if the left-hand limit, right-hand limit, and function value at that point all agree. In practical terms, this means there is no gap or jump in the graph at the transition point. Mathematically, if the breakpoint is at x = c, then lim(x approaches c from the left) f(x) must equal lim(x approaches c from the right) f(x) must equal f(c). For example, f(x) = 2x + 1 for x < 2 and f(x) = 5 for x >= 2 is continuous at x = 2 because 2(2) + 1 = 5 matches the value from the right piece. If these values differ, there is a jump discontinuity and the function has a visible break in its graph.
What is a jump discontinuity in a piecewise function?
A jump discontinuity occurs when the left-hand limit and right-hand limit exist at a breakpoint but do not equal each other. The function literally jumps from one value to another. For example, the Heaviside step function equals 0 for x < 0 and 1 for x >= 0. At x = 0, the left limit is 0 and the right limit is 1, creating a jump of size 1. Jump discontinuities are common in real-world models: an employee's hourly rate jumps at the overtime threshold, water utility rates jump at usage tiers, and tax rates jump at bracket boundaries. The size of the jump equals the absolute difference between the left and right limits. Functions with jump discontinuities are called piecewise continuous.
How do you determine if a piecewise function is differentiable at a breakpoint?
A piecewise function is differentiable at a breakpoint only if it satisfies two conditions: it must be continuous at that point AND the derivatives from both sides must be equal. Continuity alone is not sufficient. For example, the absolute value function f(x) = -x for x < 0 and f(x) = x for x >= 0 is continuous at x = 0 (both sides give f(0) = 0), but the left derivative is -1 and the right derivative is +1, so it is not differentiable at x = 0. The graph has a sharp corner there. For the function to be smooth (differentiable), the pieces must connect without a corner, meaning both the function values and the slopes must match at the breakpoint.
How do you graph a piecewise function?
To graph a piecewise function, graph each piece separately on its own restricted domain, then combine them into one coordinate plane. For each piece, draw the line or curve only over the interval where that formula applies. At breakpoints, use a solid dot (filled circle) to indicate the function value at that point, and an open dot (hollow circle) to indicate a value that is approached but not attained. For example, for f(x) = x + 1 if x < 2 and f(x) = -x + 5 if x >= 2, draw the line y = x + 1 only for x values less than 2 with an open circle at (2, 3), and draw y = -x + 5 for x >= 2 with a filled circle at (2, 3). This visual representation clearly shows continuity, jumps, and corners.
References
Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy