If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Linearity

When you double the voltage on a resistor, the current doubles. We say a resistor is a linear device. Capacitors and inductors are linear, too. Written by Willy McAllister.

Introduction

Linearity is a mathematical concept that has a profound impact on electronic design. The idea itself is quite simple, but the implications have great meaning for our field. First we will talk about the mathematical meaning of linear. Then we will apply the idea to electronic circuits.

What we're building to

A function is linear in the mathematical sense if it has these properties:
Homogeneity (scaling): f(ax)=af(x)
Additivity: f(x1+x2)=f(x1)+f(x2)
When the inputs and outputs are single numbers, a function that has the scaling property automatically has additivity as well. Resistors, capacitors, and inductors are linear because they have the scaling property.

Linear

The term linearity refers to the property of scaling. Suppose you have two related physical properties, for example the speed you can run and the distance you can run. If you double your speed, you double the distance. If you triple your speed, you triple your distance. This is called a linear relationship. Usually the cost of something is linear. If a notebook costs $1, then ten notebooks will cost $10.
In electronics, an ideal resistor creates a linear relationship between voltage and current. If you double voltage, the current doubles, and vice versa. So we say an ideal resistor is a linear element.

Scaling (homogeneity)

We want to write this scaling property in mathematical terms. This doubling-begets-doubling can be written as f(2x)=2f(x). Similarly, tripling-begets-tripling can be written as f(3x)=3f(x). And in general, the scaling property is
f(ax)=af(x)
The fancy mathematical word for this property is homogeneity.
A function that looks like a line through the origin has the scaling property. Let y=f(x)=2x.
If x=2, then y=22=4.
If we double x from 2 to 4, then y=24=8.
So doubling x exactly doubles y.
Importantly, because f(x) is a straight line, the scale factor a does not depend on the value of x.
If the function is any other shape, like y=x2 or y=1/x or y=ex, the scale factor isn't the same for every x, it depends on x's value.
For example, if y=x2/16,
At x=4, y=42/16=1, so the scale factor going from x to y is 1/4.
At x=8, y=82/16=4, so the scale factor is 1/2.
For any function that is not a straight line, scaling (amplification) is not constant, but rather depends on the input value, x.
This is the main reason we like to build and use linear amplifiers to make small signals bigger. Every signal is uniformly scaled up by the same amount, so the output looks like a scaled up replica of the input.

Adding (additivity)

When a relationship is linear (has the scaling property), we can derive an adding property. All linear functions have the form of a line with scale factor (slope) a:
f(x)=ax
If we make the input the sum of two distinct inputs (x1+x2). Then,
f(x1+x2)=a(x1+x2),
and using the distributive property,
f(x1+x2)=ax1+ax2.
The terms on the right side are equivalent to:
ax1=f(x1)ax2=f(x2)
And now we have an adding property (called additivity in math talk):
f(x1+x2)=f(x1)+f(x2)
We can use this additivity property in a clever way.
Suppose we have two inputs, x1 and x2, and we make each of them an input to a linear function, f(x). The outputs are, of course, f(x1) and f(x2).
If we add the inputs together, x1+x2, and put the sum into f(x), by definition the output will be f(x1+x2).
Here's the clever part: If f(x) happens to be a linear function, there is another way to derive the output when x1+x2 is the input. The output can also be computed from the sum of the two individual outputs, f(x1)+f(x2).
The additivity property of linear functions is called superposition. It is the basis of a circuit analysis technique that goes by the same name. Superposition is put to brilliant use in the Mesh Current Method and in many other engineering areas (especially signal processing).

Linearity of electronic components

Let's start by looking at a resistor. Mathematically, you might take the point of view that a resistor is a function that takes voltage as an input, and creates a current as an output.
We can tell if an ideal resistor is linear by testing to see if it meets the rule for scaling. We can write Ohm's Law as a function:
i=f(v)=1Rv

Resistor scaling

If we double the voltage across the resistor, the current doubles.
If we push 4 times as much current through the resistor, the voltage goes up by 4 times.

Resistor additivity

If we apply 1V+3V to the resistor, the resulting current is either
1V+3VR=4VR
or
1VR+3VR=4VR
A resistor has scaling (and therefore automatically has additivity).
A resistor is a linear element.
For a real-world resistor there is of course a limit to the voltage and current. If the power (iv) is more than the resistor can handle, it may change resistance value as it overheats, or even burn up. So a real resistor is linear only over some range of voltage and current. But an ideal resistor works for any i or v, so an ideal resistor is linear, period.

Are capacitors and inductors linear?

The capacitor and inductor element laws are
i=Cdvdt
and
v=Ldidt
At first glance it might look like these are not equations of lines. But they are. They are lines if we think of the independent variable being dv/dt and di/dt instead of just v or i.
i=f(dvdt)=Cdvdt
and
v=f(didt)=Ldidt
The capacitor law can be graphed as a straight line with dv/dt as the horizontal axis and i as the vertical axis. The slope of the capacitor line is C.
Likewise, the inductor law can be graphed as a straight line with di/dt as the horizontal axis and v as the vertical axis. The slope of the inductor line is L.
Ideal capacitors and inductors are linear elements.
Now we have three: R L C.
With just these linear components we can create many interesting electronic functions.

A diode is a non-linear device

It might help to take a second and talk something that is not a linear device, just for contrast. A diode is a non-linear semiconductor device.
We will learn a lot more about diodes later on. For now, I just want to take a look at its i-v curve as an example of what a non-linear device looks like:
Diode i-v curve of a silicon diode.
This i-v curve is the element law for a diode. It clearly does not look like a straight line, so this is definitely not a linear device. The non-linear behavior of a diode is typical of other semiconductor devices like transistors.

Why do we make such a big deal about linearity?

Answer: The math works great!
Circuit made from linear elements can be solved exactly. In fact, there is a whole branch of mathematics devoted to solving linear functions, called Linear Algebra.
Some examples of greatness: Kirchhoff's Laws work because of linearity, as do the Node Voltage Method and the Loop Current Method.

Non-linear functions and elements

In general, functions with non-linear behavior don't have these properties. We humans have not come up with a general-purpose method to exactly solve non-linear equations/circuits.
Each new type of circuit requires mathematical techniques specific to the new circuit. The usual approach to non-linear circuits is to bend over backwards to make it seem linear over at least some small range of operation. That's what is happening when you see terms like "piecewise-linear approximation" or "small-signal model."

Summary

A function is linear if it has these properties:
Homogeneity (scaling): f(ax)=af(x)
Additivity: f(x1+x2)=f(x1)+f(x2)
If x and a are real numbers (as opposed to vectors or arrays), these properties mean the same thing, and you can test for just one of them.
Resistors, capacitors, and inductors are linear elements because they have the scaling property.

Linearity in words

  1. Scaling the input by a scales the output by a.
  2. Adding two inputs produces the same output as applying each input individually and adding the two separate outputs.

Want to join the conversation?

  • blobby green style avatar for user Lateo
    Let's analyse the equation of a line, for example y=2x+3. A line should be linear by definition. But, if I were to test it by the numbers, I would get strange results. For example, let's plug x=3 and its double, x=6 into the function. The linearity principle states that f(2x) = 2f(x). So, let's try with our linear function y=2x+3.
    (1) For x=3, f(3)=2*3+3=9
    (2) For x=6, f(6)=2*6+3=15
    15 is not the double of 9. What am I getting wrong?
    Thank you for your help!
    (2 votes)
    Default Khan Academy avatar avatar for user
    • spunky sam orange style avatar for user Willy McAllister
      The term 'linear' has an everyday meaning and a different meaning in mathematics. In everyday language it means "Hey, that looks like a line." In math, it means those two properties in the article (scaling and additivity). Many, but not all, lines have the mathematical property of linearity. Only those lines that pass through the origin (lines whose y-intercept is zero) are linear in the mathematical sense. This particular restriction is what gives rise to all sorts of really good properties of linear circuits.
      (15 votes)
  • blobby green style avatar for user Deepak Gautam
    Under the subheading Adding (additivity) you claimed:

    All linear functions have the form of a line with scale factor (slope) a_:

    _f(x) = ax


    Could you give us a rigorous proof of this claim? By definition, a linear function has the following property:

    f(ax) = af(x)

    Could you show us how the statement f(ax) = af(x) implies the statement f(x) = ax ?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • spunky sam orange style avatar for user Willy McAllister
      I will use different variables for the given function and the linearity test.

      Is f(x) = ax a linear function?

      Linearity test:
      f(x) is linear if f(bx) = bf(x)

      Evaluate both sides of the linearity test and check to see if they are the same.

      Left side: f(bx) = a (bx)
      Right side: b f(x) = b (ax)

      abx = bax

      The linearity test passes, so f(x) = ax is a linear function.
      (2 votes)
  • blobby green style avatar for user Mahnoor.
    A diode is a non-linear device. Elaborate.
    (1 vote)
    Default Khan Academy avatar avatar for user
    • spunky sam orange style avatar for user Willy McAllister
      A diode is non-linear because it's i-v curve does not have the properties of scaling or additivity. The last illustration in this article shows a typical diode i-v curve. If you apply the tests for scaling or additivity to this curve, they both fail. If we drive a diode with a controlled voltage, the resulting current is not a scaled version of the voltage. That's why we say a diode is non-linear.
      (4 votes)
  • male robot donald style avatar for user Steven Williamson
    Can we say that an element is linear if its equation for current and voltage is linear?
    I ask because I'm having trouble with the language of circuit elements being linear, vs certain element equations being linear. For example the power across a resistor with respect to voltage is not linear, correct? P=V^2/R.
    (1 vote)
    Default Khan Academy avatar avatar for user
    • spunky sam orange style avatar for user Willy McAllister
      Steven - This is a really good question. The power equation you cited, P = v^2/R is not linear. It does not pass the two tests for linearity (scaling and additivity). The plot of power vs voltage is not a straight line through the origin. However, the i-v equations for R, L, and C do pass those tests.

      But you bring up a good point. We say an element is linear if some (but not all) aspects are linear. Seems kind of arbitrary. The only thing I can think of is the circuit problems we are solving are digging into how all the voltages and currents in the circuit work themselves into a mutually agreeable state. While i and v are doing this, there isn't anything that involves balancing or trading off power between elements. Power isn't part of the journey to a solution, nor does it cause i or v to change. So in this regard, as long as we care only about variables (i and v) that have a linear relationship, we can use theories like superposition as tools for solving circuits.

      I'm open to any other thoughts on this from a mathematics perspective.
      (1 vote)