Skip to main content

Repair: Variables, Functions and Inequalities

This repair is needed before Semester 01. You can work through it alongside Semester 00 once the computer, arithmetic and technical-reading gates are met.

Expressions and equations​

A variable stands for a value. 4x + 2 is an expression; 4x + 2 = 18 is an equation claiming that two expressions are equal. Solve by preserving equality: subtract 2 from both sides to obtain 4x = 16, then divide both sides by 4 to obtain x = 4. Substitute back: 4 × 4 + 2 = 18. The check can catch an arithmetic slip.

The shorthand 4x means multiplication. It is not valid Python multiplication syntax; Python requires 4 * x. Mathematical equality is also different from a programming assignment that updates a variable.

Functions and graphs​

A function assigns one output to each allowed input. For f(n) = 3n + 2, inputs 0, 1, 2 give outputs 2, 5, 8. The ordered pairs are (0, 2), (1, 5), (2, 8): input first, output second. Draw input on the horizontal axis and output on the vertical axis. Equal increments of input produce equal increments of output here, so these points lie on a straight line.

If n counts files, its domain may be the nonnegative integers: half a file is not a valid count in that model. A formula alone does not tell you the allowed input domain. An output measured in milliseconds also needs its unit stated.

For T(n) = 4 + 3n milliseconds, the fixed setup cost is 4 milliseconds and each item adds 3 milliseconds. Doubling n does not generally double the total because of that fixed cost: T(2) = 10, while T(4) = 16.

Inequalities describe sets of answers​

Solve 3x + 2 ≤ 14: subtract 2, then divide by positive 3 to get x ≤ 4. Both 4 and 0 satisfy the condition; 5 does not. One example is not the whole solution set. Multiplying or dividing both sides by a negative number reverses the comparison: from -2x ≤ 6, dividing by -2 gives x ≥ -3. Check with -3 and 0, then try -4.

Practice and feedback​

Solve 5x - 4 = 21. Evaluate g(n) = 4n + 1 at 0 and 3. Solve 2x + 3 ≤ 11. Give one allowed and one disallowed integer for the last result. Plot three input-output points for g and state a possible domain.

Answers: x = 5; 1 and 13; x ≤ 4 (4 allowed, 5 disallowed). Possible plotted points: (0,1), (1,5), (3,13). Nonnegative integer input is suitable if n counts tasks. A real-number domain can fit a different interpretation; explain the model you chose.

Complete domain C of the fresh reassessment. Use OpenStax Elementary Algebra 2e selectively for equations, inequalities and graphing. Full-book study is a separate option, not a requirement to begin programming.