# 4 - Functions

## Functions

First of all, what is a function? A function, or a mapping, is kind of like an infernal machine, a system which is a little complicated though logical, something abstract enough at the beginning, in short a sort of creature, to whom you give a number and comes out with another number. For example for the function f(x) = 2x + 3, if you give it 5, you will get . If you give it 10, it will give you back f(10) = 23, if you give it (-4) you will have (-5), if you give it 0,5 you will have 4. There are many functions, , , and even :

They are functions!
We will start by studying only one type of functions : the linear functions : the ones which are written f(x) = 2x+3, g(x) = 4x-2, h(x) = 0,3x+1,65, in short the ones who are of the type f(x) = ax+b

## Graphic representation

A function can be represented by a graph :

 For each value of x on the horizontal axis (the x axis), you can calculate the value of the corresponding f(x).
 Concerning the function f(x) = 2x+3, if you have x = 1 you have also f(x) = 5. You make a small cross at 1, the abscissa of the point, and 5 for the y axis (at point 5 for the height), that is to say here :
You do the same when you choose haphazardly other values of x and when you calculate each time the corresponding value of f(x), by placing the point just as you did it above. For example for x = -1, f(x) = 1 and for x = -3, f(x) = -3. When you have enough points, you link them you get the graphic representation of the function.
In the case of our function f(x)=2x+3, its graphic representation is a straight line. In fact, all the linear functions are represented by straight lines.

## Slope

For linear functions, the number a which is in front of x is called the slope of the line. It measures the rising gradient of the line. If you take one point on the straight line, and if you move 1 spot forward horizontally, you must move a spots upwards to reach the line. In the example below, you can see very well in blue that you need to climb 2 to reach the straight line. It was the number which was in front of x in the expression of the function.
Number b which is in the expression of the function is called y-intercept (or ordinate at origin). It is equal to the height at which the straight line cuts the y axis (the vertical axis). In the case of our function, b=3 (yellow point).

Finally, if you know the coordinates A and B of two points on a straight line, you can calculate the slope of this straight line. You must use the following formula: