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

Variables, expressions, & equations

In algebra, we use variables like x, y, and z to represent unknown values. Expressions are combinations of variables and numbers, while equations equate two expressions. Variables can take on different values depending on the context, and we can evaluate expressions by substituting values for the variables. Created by Sal Khan.

Want to join the conversation?

  • female robot ada style avatar for user Nandhini
    What's the difference between a variable and an expression?
    (245 votes)
    Default Khan Academy avatar avatar for user
  • leaf blue style avatar for user Matthew Daly
    When you evaluate x^y for x = -2 and y = 3, you should be careful to write it as (-2)^3 and not -2^3. Remember that exponents have precedence over subtraction, so the latter is not -2 x -2 x -2, but -(2 x 2 x 2). In this case, you get -8 either way, of course.
    (173 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user dianae219
    In the example x=-2 to the power y=3 you write -2^3 that is a mistake, the right way to do it is (-2)^3 ; because the "-" sign belong to the number "2". It is no the same:
    (-2)^2=4 to -2^2=-4. Thanks so much for what you are doing.
    (51 votes)
    Default Khan Academy avatar avatar for user
  • duskpin sapling style avatar for user Angelina Snow
    In algebra, The letter X always appears. What does X represent?
    (20 votes)
    Default Khan Academy avatar avatar for user
    • primosaur ultimate style avatar for user kaitlyn
      as said above, it is used to represent an unknown number. "Solving for x" means finding which number x represents. X can actually be any letter, but x is just the most common. For example, you could also "solve for a".
      (22 votes)
  • piceratops sapling style avatar for user matthew.zaremba
    I saw the video but I still don't understand. Can someone tell the difference between expressions, equations, and inequalities in a simpler way?
    (14 votes)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      Expressions have one or more terms which are separated by plus and minus signs. All we can do with these is simplify or evaluate for given values. Examples could include x, 3x + 2y, etc.
      Next, we can set two expressions equal to each other by creating an equation. This will allow us to solve or isolate a variable. Examples could be 2x + 5 = 3x - 9 or y = 3x - 2. With two variables, an equation can be a function if each input (x in the equation above) has at most one output value (y in the equation above). With a single variable, the solution is a point on the number line, and with two variables it ends up as a line or curve on a Cartesian Plane.
      The inequalities (greater than, greater than or equal to, less than, less than or equal to, and not equal to) allows for multiple solutions. On a number line, it creates ray(s) or a line, and it is an area on the Cartesian Plane. The equality part of the inequality would form a line or curve which could be solid or dashed and shading either above or below this line or curve.
      (28 votes)
  • male robot hal style avatar for user TheOGTristan
    is it possible that there is so many variables in a equation that the problem is unsolvable
    (17 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user davidz10000
    I JUST LOVE HOW WE HAVEN'T LEARNED THE SQUARE ROOT and it gives it to us here xD. So, basically the square root of something is the same thing as saying 9^1/2. That half just means taking the half of the exponent that 9^1 is equal to. Think of it like 9 = 3^2 = 3 x 3. This "^" sign is just means the number in front of it is exponent, we also refer it to "power of". So you have 3^2, which is equal to 3 x 3. If you take HALF of the exponent in the expression, which is 2, that is going to leave you with an exponent of 1, which is 3^1 = 3(or 1 x 3).
    Another way to think of it, is 9^1 is equal to 3^2. 3^2 = 1 x 3 x 3. So what is half of what we are doing, which is multiplying 1 by 3 two times? Well, that's multiplying 1 by 3 only one time :), 1 x 3 = 3.
    (15 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Steven
    So variables mean a mystery number or it can just sometimes be there and not mean anything in an equation
    (10 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user JustinEBT
    Where can we use Algebra in real life?
    (10 votes)
    Default Khan Academy avatar avatar for user
  • stelly yellow style avatar for user angelina
    I watched the video, but I'm still having a little trouble understanding what the difference is between an expression, inequality, and equation. Can someone explain it a bit simpler for me, please?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      An expression can be as simple as a number or a variable. Or, it can be a mix of numbers, variables, and math operations for addition, subtraction, multiplication and division. It will not have any equals symbol (=). Nor will it have any inequality symbol (>, <).

      An equation requires 2 expression separated by an equals symbol (=).

      An inequality also takes 2 expressions separated by an inequality symbol ("<", ">", "<=", ">=").

      Hope this helps.
      (11 votes)

Video transcript

When we're dealing with basic arithmetic, we see the concrete numbers there. We'll see 23 plus 5. We know what these numbers are right over here, and we can calculate them. It's going to be 28. We can say 2 times 7. We could say 3 divided by 4. In all of these cases, we know exactly what numbers we're dealing with. As we start entering into the algebraic world-- and you probably have seen this a little bit already-- we start dealing with the ideas of variables. And variables, there's a bunch of ways you can think about them, but they're really just values in expressions where they can change. The values in those expressions can change. For example, if I write x plus 5, this is an expression right over here. This can take on some value depending on what the value of x is. If x is equal to 1, then x plus 5, our expression right over here, is going to be equal to 1. Because now x is 1. It'll be 1 plus 5, so x plus 5 will be equal to 6. If x is equal to, I don't know, negative 7, then x plus 5 is going to be equal to-- well, now x is negative 7. It's going to be negative 7 plus 5, which is negative 2. So notice x here is a variable, and its value can change depending on the context. And this is in the context of an expression. You'll also see it in the context of an equation. It's actually important to realize the distinction between an expression and an equation. An expression is really just a statement of value, a statement of some type of quantity. So this is an expression. An expression would be something like what we saw over here, x plus 5. The value of this expression will change depending on what the value of this variable is. And you could just evaluate it for different values of x. Another expression could be something like, I don't know, y plus z. Now everything is a variable. If y is 1 and z is 2, it's going to be 1 plus 2. If y is 0 and z is negative 1, it's going to be 0 plus negative 1. These can all be evaluated, and they'll essentially give you a value depending on the values of each of these variables that make up the expression. An equation, you're essentially setting expressions to be equal to each other. That's why they're called equations. You're equating two things. An equation, you'll see one expression being equal to another expression. For example, you could say something like x plus 3 is equal to 1. And in this situation where you have one equation with only one unknown, you can actually figure out what x needs to be in this scenario. And you might even do it in your head. What plus 3 is equal to 1? Well, you could do that in your head. If I have negative 2, plus 3 is equal to 1. In this context, an equation is starting to constrain what value this variable can take on. But it doesn't have to necessarily constrain it as much. You could have something like x plus y plus z is equal to 5. Now you have this expression is equal to this other expression. 5 is really just an expression right over here. And there are some constraints. If someone tells you what y and z is, then you're going to get an x. If someone tells you what x and y is, then that constrains what z is. But it depends on what the different things are. For example, if we said y is equal to 3 and z is equal to 2, then what would be x in that situation? If y is equal to 3 and z is equal to 2, then you're going to have the left-hand expression is going to be x plus 3 plus 2. It's going to be x plus 5. This part right over here is just going to be 5. x plus 5 is equal to 5. And so what plus 5 is equal to 5? Well, now we're constraining that x would have to be equal to 0. Hopefully you realize the difference between expression and equation. In an equation, essentially you're equating two expressions. The important thing to take away from here is that a variable can take on different values depending on the context of the problem. And to hit the point home, let's just evaluate a bunch of expressions when the variables have different values. For example, if we had the expression x to the y power, if x is equal to 5 and y is equal to 2, then our expression here is going to evaluate to, well, x is now going to be 5. y is going to be 2. It's going to be 5 to the second power, or it's going to evaluate to 25. If we changed the values-- let me do that in that same color-- if we said x is equal to negative 2 and y is equal to 3, then this expression would evaluate to-- let me do it in that-- negative 2. That's what we're going to substitute for x now in this context. And y is now 3, negative 2 to the third power, which is negative 2 times negative 2 times negative 2, which is negative 8. Negative 2 times negative 2 is positive 4, times negative 2 again is equal to negative 8. We could do even more complex things. We could have an expression like the square root of x plus y and then minus x, like that. Let's say that x is equal to 1 and y is equal to 8. Then this expression would evaluate to, well, every time we see an x, we want to put a 1 there. So we would have a 1 there, and you'd have a 1 over there. And every time you see a y, you would put an 8 in its place in this context. We're setting these variables. So you'd see an 8. Under the radical sign, you would have a 1 plus 8. So you'd have the principal root of 9, which is 3. This whole thing would simplify. In this context, when we set these variables to be these things, this whole thing would simplify to be 3. 1 plus 8 is 9. The principal root of that is 3. And then you'd have 3 minus 1, which is equal to 2.