# Variables and Expressions

## Introduction to variables and expressions

A variable is a letter (like \$x\$) that we can use to mean different numbers at different times. An expression is a combination of variables and numbers using arithmetic (like \$6-x\$). A constant is a single fixed number, like \$3\$.

In each row of this table, \$x\$ represents a different number, which is given in the middle column.

Type the number \$6-x\$ in the row where \$x=1\$. This value is illustrated by the small green squares to the left.

Then click or tap on the button to check your answer and proceed to the next row of the table. Do this for each row of the table. (You can switch between answer blanks by pressing the tab key, or enter while on a button.)

\$x\$\$6-x\$

Find the value of \$2(x)+5\$, where \$x\$ is each of the numbers shown.

\$x\$\$2(x)+5\$

## Sliders

We can put a slider under the grid to represent \$x\$. By sliding the slider back and forth and watching what happens to the grid, you can see how an expression like \$2(x)+5\$ changes value when \$x\$ does.

The table from lin-expr-qn is copied and extended below. Using the slider, make \$x\$ be each of the numbers in the first column of that table.

The number of green squares on the grid is the value of the expression \$2(x)+5\$. Count the number of green squares, and enter it in the right column.

\$x\$\$2(x)+5\$

The grid and slider to the left show you the expression \$3(x)-2\$. Count the number of green squares minus the number of pink squares on the grid, and enter it in the right column. (The pink squares on the grid represent a negative or subtracted quantity.)

\$x\$\$3(x)-2\$
For each row of this table, the top grid and slider to the left illustrate some specific expression. The bottom grid and slider illustrate whatever expression you type into the table to the right.

Fill in each row of the table, so that the bottom grid matches the top grid no matter what value you slide the slider to. (If you want, you can always go back to see a previous example by clicking on its or button.)

## Variables with fractional values

Use the grid and slider to the left to find the value of the expression \$3(x)+4\$ when \$x\$ is each of the numbers shown in the table below. Notice that the value of \$x\$ may now be a fractional number like 1.5.

\$x\$\$3(x)+4\$

## Multiplying without parentheses

We often have expressions where we’re multiplying variables by numbers. Because this is so common, we leave off the parentheses in this kind of multiplication. For example, we write \$4x\$ instead of \$4(x)\$. When we do this, we always write the number before the variable.

For each row of the table below, an expression (written without parentheses) and a value of \$x\$ is given. Use the slider and the grid to the left to find the value of the expression when \$x\$ takes on the given value.

xexpressionvalue of expression
For each row of this table, the top grid and slider to the left illustrate some expression. Find that expression. The expression you type in will be shown on the bottom grid.