AI Math Tutor

Blog · algebra

Basics of Algebra: Variables, Equations and Functions

· AI Math Tutor Team

The basics of algebra come down to one shift in thinking: instead of working only with numbers you already know, you start working with a letter that stands for a number you do not know yet. That letter, usually x, is called a variable, and everything else in algebra, expressions, equations, inequalities, and functions, is really a set of tools for figuring out what that variable equals or how it behaves. This guide covers the basics of algebra in order, from what a variable is to solving your first equations and reading your first function, with three worked examples along the way.

Key takeaways

What a variable is and why algebra uses letters

A variable is a letter, most often x or y, standing in for a number that either is not known yet or that changes depending on the situation. In the equation x+5=12x + 5 = 12, x stands for whatever number, once added to 5, gives 12. You do not know that number yet, but you can find it, and that is the whole point of algebra: turning a question about an unknown number into a series of steps that reveal it.

Variables also describe relationships between quantities that change together, not just single unknown numbers. If a car travels at a constant speed, the distance it covers depends on how long it travels, and writing distance =speed×time= \text{speed} \times \text{time} uses letters to describe that relationship for any speed and any amount of time, not just one specific trip.

Letters are useful precisely because they can stand for more than one thing at a time. In x+5=12x + 5 = 12, x stands for one specific unknown number you are solving for. In the distance formula, speed and time can each be any number, and the formula still describes the relationship correctly. Both uses rely on the same idea: a letter holds a place for a number so you can reason about it before you know its value.

Expressions vs equations

An expression is any combination of numbers, variables, and operations, such as 3x+73x + 7 or 2(x−4)2(x - 4). An expression has no equals sign, so it cannot be solved, only simplified. Simplifying an expression usually means combining like terms, terms that have the same variable raised to the same power. In 2x+5x−32x + 5x - 3, the two x terms combine to give 7x−37x - 3, since 2x2x and 5x5x are like terms but −3-3 is not.

An equation sets two expressions equal to each other, such as 3x+7=223x + 7 = 22. Because an equation makes a claim, that these two expressions are equal, you can test whether a particular value of x makes that claim true, and you can solve the equation to find exactly which value does. The equals sign is what turns a static expression into a question with an answer.

Simplifying an expression sometimes starts with distributing a number across parentheses before you can combine like terms. In 3(x+4)−2x3(x + 4) - 2x, distribute the 3 first: 3x+12−2x3x + 12 - 2x. Then combine the like terms, the two x terms, to get x+12x + 12. Distributing before combining matters, because 3x3x and 2x2x are not visible as separate like terms until the parentheses are gone.

Order of operations in algebra

Every expression and equation in algebra still follows the same order of operations you use with plain numbers: parentheses first, then exponents, then multiplication and division from left to right, then addition and subtraction from left to right. The expression 2+3x22 + 3x^2 means take x, square it, multiply by 3, and then add 2, not add 2 and 3 before squaring anything.

This order matters just as much when a variable is involved as when it is not. Evaluating 2+3x22 + 3x^2 at x=2x = 2 means squaring 2 first to get 4, multiplying by 3 to get 12, and then adding 2, for a result of 14. Skipping the order and adding 2 and 3 first would give a completely different, incorrect result.

Solving one-step equations

A one-step equation needs exactly one operation undone to isolate the variable. If the equation adds or subtracts a number from the variable, undo it by subtracting or adding that same number on both sides. If the equation multiplies or divides the variable by a number, undo it with the opposite operation.

Whatever you do to one side of an equation, you have to do to the other side too, or the two sides stop being equal. This is the single rule that makes every other algebra technique work: an equation stays true as long as both sides change by the same amount in the same way.

Solving two-step equations

A two-step equation needs two operations undone, and the order matters. Undo addition or subtraction first, then undo multiplication or division. This order works because it reverses the order those operations would normally happen in, peeling the equation back one layer at a time until the variable is alone.

In 3x−5=163x - 5 = 16, the variable x has been multiplied by 3 and then had 5 subtracted. To reverse that, add 5 first, then divide by 3. Doing the steps in the opposite order, dividing by 3 while the −5-5 is still there, would divide the 5 along with everything else and produce the wrong equation entirely.

Equations with the variable on both sides

Some equations have the variable on both sides, such as 5x−3=2x+95x - 3 = 2x + 9. The first move is always to gather the variable on one side by adding or subtracting one of the variable terms from both sides. Subtracting 2x2x from both sides turns 5x−3=2x+95x - 3 = 2x + 9 into 3x−3=93x - 3 = 9, which is now a two-step equation you already know how to solve: add 3 to both sides to get 3x=123x = 12, then divide by 3 to get x=4x = 4.

It does not matter which variable term you choose to move, as long as you move the same term from both sides. Subtracting 5x5x instead would give −3=−3x+9-3 = -3x + 9, and solving that equation from here leads to the same value of x, just by a slightly different path.

Inequalities: like equations, with one extra rule

An inequality compares two expressions using <<, >>, ≤\le, or ≥\ge instead of an equals sign, and it solves almost exactly like an equation: undo operations on both sides in the same order you would for an equation. The one difference is that multiplying or dividing both sides by a negative number flips the direction of the inequality sign.

This flip keeps the inequality true. If 2<52 < 5, multiplying both sides by −1-1 gives −2-2 and −5-5, and −2-2 is actually greater than −5-5, not less than it, so the sign has to flip to −2>−5-2 > -5 for the statement to stay accurate. Every solution to an inequality is usually a whole range of numbers, not a single value, which is different from most equations. For what happens when an equation itself has no single solution or infinitely many, see How Many Solutions Does an Equation Have? One, None, Many.

Functions: rules that connect inputs and outputs

A function is a rule that takes an input and produces exactly one output for it. The notation f(x)f(x) names the rule and shows what it does to an input called x. If f(x)=2x+1f(x) = 2x + 1, then f(3)f(3) means plugging 3 in for x: f(3)=2(3)+1=7f(3) = 2(3) + 1 = 7.

Functions describe how one quantity depends on another, the same idea behind the distance and speed example earlier, but with notation that makes it easy to plug in specific values and read off the result. Plotting the inputs and outputs of a function on a graph, with inputs along the horizontal axis and outputs along the vertical axis, turns that rule into a picture you can read at a glance, which is often the fastest way to see how a function behaves as the input changes. For a deeper look at function notation, graphs, and how to read them, see Algebraic Functions Explained: Notation, Graphs, Examples.

Worked examples

Example 1: solve the one-step equation x+9=17x + 9 = 17

  1. Subtract 9 from both sides to undo the addition and isolate x.
    x+9−9=17−9x + 9 - 9 = 17 - 9
  2. Simplify both sides.
    x=8x = 8

So x=8x = 8. Check it by substituting back into the original equation: 8+9=178 + 9 = 17, which matches.

Example 2: solve the two-step equation 3x−5=163x - 5 = 16

  1. Add 5 to both sides to undo the subtraction.
    3x−5+5=16+53x - 5 + 5 = 16 + 5
    3x=213x = 21
  2. Divide both sides by 3 to isolate x.
    x=7x = 7

So x=7x = 7. Check it by substituting back: 3(7)−5=21−5=163(7) - 5 = 21 - 5 = 16, which matches.

Example 3: solve the inequality 2x+3<112x + 3 < 11

  1. Subtract 3 from both sides.
    2x<82x < 8
  2. Divide both sides by 2. Since 2 is positive, the inequality sign stays the same.
    x<4x < 4

So the solution is x<4x < 4. Check it by testing a number in the solution set, like x=3x = 3: 2(3)+3=92(3) + 3 = 9, and 9<119 < 11 is true. Testing the boundary, x=4x = 4, gives 2(4)+3=112(4) + 3 = 11, which is not less than 11, confirming that 4 itself is not part of the solution.

Common mistakes

Not every equation ends with a single clean number for x. Some have no solution at all, and some have infinitely many, both covered with examples in How Many Solutions Does an Equation Have? One, None, Many. Once one-step and two-step equations feel comfortable, Algebra Examples With Answers: 12 Problems Worked Out gives you more practice across the whole topic, and How to Solve Any Math Problem Step by Step covers a method that extends well beyond algebra. When you want your own equation checked line by line, scan it and read every step in AI Math Tutor.

AI Math Tutor is a study aid, not a substitute for a teacher, and it can make mistakes: check every step, not just the answer.

Questions

What is the difference between an expression and an equation?

An expression, like 3x+73x + 7, is a combination of numbers, variables, and operations with no equals sign, so it can only be simplified, not solved. An equation, like 3x+7=223x + 7 = 22, sets two expressions equal to each other, which means you can solve it for the value of the variable.

What does it mean to solve an equation?

Solving an equation means finding the value or values of the variable that make the equation true. You isolate the variable by doing the same operation to both sides of the equation, undoing whatever was done to the variable, until the variable stands alone.

Why does the inequality sign flip sometimes?

The inequality sign flips only when you multiply or divide both sides of an inequality by a negative number. This keeps the inequality true, since multiplying by a negative number reverses the order of the numbers on the number line.

What is a function in algebra?

A function is a rule that assigns exactly one output to each input. The notation f(x)f(x) names that rule, so f(3)f(3) means the output the function produces when the input is 3.

Do you need to know basic algebra before learning about quadratic equations?

Yes. Quadratic equations build directly on solving linear equations and working with expressions, so being comfortable with one-step and two-step equations first makes quadratics much easier to learn.

Read next