Pulsars
0 %
Log inSign up

Affine and quadratic functions

The affine function

Definition

An affine function is a function of the form f(x) = a*x + b, where a and b are fixed real numbers known as the slope and the y-intercept, respectively.

Special cases:

  • if b = 0, f is called a linear function: f(x) = a*x
  • if a = 0, f is a constant function: f(x) = b

Graphical representation

The graph of an affine function is a straight line.

  • a gives the slope of the line: if a > 0, the function is increasing; if a < 0, it is decreasing; if a = 0, it is constant.
  • b gives the y-coordinate of the point where the line intersects the y-axis (when x = 0).

Example

Let f(x) = 2*x - 3.

  • f(0) = -3 (y-coordinate at the origin)
  • f(1) = -1
  • f(2) = 1
x -1 0 1 2
f(x) -5 -3 -1 1

The slope a = 2 means that as x increases by 1, f(x) increases by 2.

Common pitfall

Do not confuse the slope a with the y-intercept b. To find a from two points (x1;y1) and (x2;y2), use a = (y2 - y1)/(x₂ – x₁), never the other way round.