The linear function
The linear function is arguably the most important function in mathematics. It's one of the easiest functions to understand, and it often shows up when you least expect it. Because it is so nice, we often simplify more complicated functions into linear functions in order to understand aspects of the complicated functions.
Unfortunately, the term “linear function” means slightly different things to different. Fortunately, the distinction is pretty simple. We first outline the strict definition of a linear function, which is the favorite version in higher mathematics. Then, we discuss the rebellious definition of a linear function, which is the definition one typically learning in elementary mathematics but is a rebellious definition since such a function isn't linear.
The strict view of the linear function
In one variable, the linear function is exceedingly simple. A linear function is one of the form $$f(x)=ax,$$ where the parameter $a$ is any real number. The graph of $f$ is a line through the origin and the parameter $a$ is the slope of this line.
A linear function of one variable. The linear function $f(x)=ax$ is illustrated by its graph, which is the green line. Since $f(0)=a \times 0 =0$, the graph always goes through the origin $(0,0)$. You can change $f$ by typing in a new value for $a$, or by dragging the blue point with your mouse. The parameter $a$ is the slope of the line, as illustrated by the shaded triangle.
One important consequence of this definition of a linear function is that $f(0)=0$, no matter what value you choose for the parameter $a$. This fact is the reason the graph of $f$ always goes through the origin. By this strict definition of a linear function, the function $$g(x) = 3x +2$$ is not a linear function, as $g(0) \ne 0$.
Why this insistence that $f(0)=0$ for any linear function $f$? The reason is that in mathematics (other than in elementary mathematics), we don't define linear by the requirement that the graph is a line. Instead, we require certain properties of the function $f(x)$ for it to be linear.
One important requirement for a linear function is: doubling the input $x$ must double the function output $f(x)$. It's easy to see that the function $g(x)$ fails this test. For example, $g(1)=5$ and $g(2)=8$, which means that $g(2) \ne 2g(1)$. We can write this requirement for a linear function $f$ as $$f(2x)=2f(x)$$ for any input $x$. If $f(x)=ax$, then $f(2x)=2ax$ and $2f(x)=2ax$, so this requirement is satified.
To satisfy this doubling requirement, we must have $f(0)=0$. This follows from the fact that if you double zero, you get zero back. Therefore, the doubling requirement means $f(0)=2f(0)$, so $f(0)$ is a number that is the same if you double it; i.e., $f(0)=0$.
By the way, for a linear function, this property must be satisfied for any number, not just the number 2. A linear function must satisfy $f(cx)=cf(x)$ for any number $c$. The other requirement for a linear function is that applying $f$ to the sum of two inputs $x$ and $y$ is the same thing as adding the results from being applied to the inputs individually, i.e., $f(x+y)=f(x)+f(y)$.
The rebellious view of the linear function
The rebellious view of the linear function is to call any function of the form $$f(x)=ax+b$$ a linear function, since its graph is a line.
An affine function of one variable. The affine function $f(x)=ax+b$ is illustrated by its graph, which is the green line. Since $f(0)=a \times 0 +b=b$, the graph always goes through the $y$-axis at the point $(0,b)$, which is illustrated by the gray point. You can change $f$ by typing in a new values for $a$ or $b$, or by dragging the blue points with your mouse. The parameter $a$ is the slope of the line, as illustrated by the shaded triangle.
However, as mentioned above, this type of function with $b \ne 0$ does not satisfy the properties for linearity. So, to call $f$ a linear fuction, we have to rebellious ignore such facts to the contrary. Strictly, if $b \ne 0$, then $f$ should be called an affine function rather than a linear function.
Given that this rebellious view is firmly entrenched in elementary mathematics, we might sometimes join in and use this terminology. If it doesn't seem worthwhile to insist on the distinction, we might use the term linear function when we should really use the term affine function.
In other contexts, the properties of linearity are critical for the mathematical analysis. In such cases, we'll be careful to insist that a linear function $f(x)$ does satisfy that $f(0)=0$, and make the distinction between linear and affine functions.