What is the difference between affine and linear functions? An affine function is the composition of a linear function with a translation. So while the linear part fixes the origin, the translation can map it somewhere else.
Affine functions are of the form f(x)=ax+b, where a ≠ 0 and b ≠ 0 and linear functions are a particular case of affine functions when b = 0 and are of the form f(x)=ax. Therefore, one can say that linear functions are also affine functions.
But, the difference between affine and linear functions is that linear functions cross the origin of the graph at the point (0 , 0) while affine functions do not cross the origin.
In the example below, the blue line represents an affine function and the red line represents a linear function.