practicecalculus
Algebraic functions

Constant Function f(x) = c: Graph, Derivative, Integral and Properties

The constant function f(x) = c: its horizontal-line graph, why its derivative is 0, its integral cx + C, limits, and common mistakes with constants.

Algebraic functions Updated 3 min read

At a glance

f(x) = c
Domain
(-\infty, \infty)
Range
The single value \{c\}
Derivative
0
Integral
cx + C
Graph
A horizontal line through (0, c)
Slope
0 everywhere
On this page
  1. Definition and formula
  2. Graph of a constant function
  3. Derivative of a constant
  4. Integral of a constant
  5. Key properties
  6. Worked examples
  7. Common mistakes
  8. How it connects

A constant function returns the same number no matter what you put in. Written f(x) = c, where c is a fixed real number, it is the simplest function in calculus and the starting point for every derivative and integral rule.

Definition and formula

f(x) = c

Here c can be any real number: f(x) = 3, g(x) = -\tfrac{1}{2}, h(x) = \pi. The input x does not appear on the right-hand side, so changing x never changes the output. Examples you meet in practice include a fixed fee, a constant speed's acceleration (zero), or the value f(a) once a is fixed.

Graph of a constant function

The graph of y = c is a horizontal line crossing the y-axis at (0, c). Every point on it has the same height.

Graph of the constant functions y = 3 and y = -2
Each constant function is a horizontal line. Its slope, and therefore its derivative, is 0 everywhere.

Derivative of a constant

The derivative of a constant is zero:

\frac{d}{dx}\, c = 0

From the limit definition of the derivative:

f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h} = \lim_{h \to 0} \frac{c - c}{h} = \lim_{h \to 0} 0 = 0

Geometrically, a horizontal line has slope 0, so every tangent line is the line itself. This fact is the constant rule, and it explains why the constant term of a polynomial disappears when you differentiate.

Integral of a constant

Going backwards, a function whose derivative is c is cx, so

\int c\,dx = cx + C

For a definite integral, the area under y = c from a to b is a rectangle with height c and width b - a:

\int_a^b c\,dx = c(b - a)

If c is negative, the rectangle sits below the axis and the signed area is negative.

Key properties

  • Continuous and differentiable everywhere. There are no breaks, holes or corners.
  • Limits are trivial. \lim_{x \to a} c = c for every a, and also \lim_{x \to \pm\infty} c = c.
  • Even function. f(-x) = f(x), so the graph is symmetric about the y-axis.
  • Neither increasing nor decreasing. It is both nonincreasing and nondecreasing.
  • Every point is a maximum and a minimum. Since the output never changes, every x gives both the largest and smallest value.
  • Degree zero polynomial. A nonzero constant is cx^0, the bottom rung of the polynomial functions.

Worked examples

Example 1. Differentiate f(x) = 7. The derivative is f'(x) = 0.

Example 2. Differentiate g(x) = 4x^2 + 9. By the sum rule, g'(x) = 8x + 0 = 8x. The 9 contributes nothing.

Example 3. Differentiate y = \pi^2. Although it looks complicated, \pi^2 \approx 9.87 is just a number, so y' = 0.

Example 4. Evaluate \int_1^4 5\,dx. The antiderivative is 5x, so the value is 5(4) - 5(1) = 15, the area of a 5 \times 3 rectangle.

Common mistakes

  1. Treating constants that look like expressions as variables. e^2, \ln 3 and \sin\frac{\pi}{6} are numbers, so their derivatives are 0. Students often write \frac{d}{dx}e^2 = e^2 by mistake.
  2. Forgetting the x when integrating. \int 5\,dx = 5x + C, not 5 + C.
  3. Mixing up c and C. The constant of integration C is new and arbitrary. It is not the same number as the c in f(x) = c.
  4. Dropping a constant factor. The derivative of a constant term is 0, but a constant factor stays: \frac{d}{dx}(5x) = 5, not 0. See the constant multiple rule.

How it connects

A constant function is a linear function with slope 0, and the special case n = 0 of the power functions. In applications, a derivative equal to zero on an interval tells you the original function is constant there, a consequence of the mean value theorem. That is also why every antiderivative carries a +\,C: two functions with the same derivative differ by a constant. For more on this, read the guide to antiderivatives.

Practice it now

Sums and constants

Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.

Practice this lesson

Frequently asked questions

What is the derivative of a constant?

The derivative of any constant is 0. A constant never changes, so its rate of change is zero, and the graph of y = c is a flat line with slope 0.

What is the integral of a constant?

The integral of a constant c is \int c\,dx = cx + C. For example, \int 5\,dx = 5x + C, because the derivative of 5x is 5.

Is a constant function continuous?

Yes. A constant function is continuous and differentiable at every real number. Its limit at any point a is simply c.

Is a constant function a polynomial?

Yes. A nonzero constant is a polynomial of degree 0, since c = cx^0. The zero function f(x) = 0 is also a polynomial, though its degree is usually left undefined.

Is a constant function even or odd?

Every constant function is even, because f(-x) = c = f(x). Only the zero function is both even and odd.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.