# Linearization – linear approximation of a nonlinear function

A nonlinear function can be approximated with an linear function in a certain operating point. The process of linearization, in mathematics, refers to the process of finding a linear approximation of a nonlinear function at a given point (x0, y0).

Image: Nonlinear function with tangent line

For a given nonlinear function, its linear approximation, in an operating point (x0, y0), will be the tangent line to the function in that point.

### Linearization – theoretical background

A line is defined by a linear equation as:

$y = mx + b \tag{1}$

where:

m – the slope of the line
b – the vertical offset of the line

Image: Line with slope and offset

The slope m of the line can be defined as the tangent function of the angle (α) between the line and the horizontal axis:

$m = tan(\alpha) = \frac{dy}{dx} \tag{2}$

where dy and dx are small variations in the coordinates of the line.

Another way of defining a line, is by specifying the slope m and a point (x0, y0) through which the line passes. The equation of the line will be:

$y – y_0 = m (x – x_0) \tag{3}$

Replacing equation (2) in (3) gives:

$y – y_0 = \frac{dy}{dx} (x – x_0) \tag{4}$

Equation (4) translates into: for a given nonlinear function, its linear approximation in an operating point (x0, y0) depends on the derivative of the function in that point.

In order to get a general expression of the linear approximation, we’ll consider a function f(x) and the x-coordinate of the function a. The y-coordinate of the function will be f(a).

$\begin{split} x_0 &= a\\ y_0 &= f(a)\\ m &= f'(a) \end{split}$

Replacing these in equation (3) gives:

$\begin{split} y – f(a) &= f'(a) (x – a)\\ y &= f(a) + f'(a) (x – a) \end{split}$

We can now write the general linear approximation L(x) of a nonlinear function f(x) in a point a as:

$\bbox[#FFFF9D]{L(x) = f(a) + f'(a)(x-a)}$

### Linearization – practical example

Let’s find a linear approximation of the function f(x) in the point a = 1.

$f(x) = x^3 – x^2 + 5$

The graphical representation of the function is:

Image: Nonlinear function with linearization point

Step 1. Calculate f(a)

$f(1) = 1 – 1 + 5 = 5$

Step 2. Calculate the derivative of f(x)

$f'(x) = 3x^2 – 2x$

Step 3. Calculate the slope of the linear approximation f'(a)

$f'(1) = 3 – 2 = 1$

Step 4. Write the equation L(x) of the linear approximation

$L(x) = 5 + 1 \cdot (x – 1) = x + 4$

If we plot the linear approximation L(x) on the same graph, we get:

Image: Nonlinear function with linearization point and linear approximation

As expected, the linear approximation L(x) in the point (a, f(a)) is tangent to the nonlinear function.

If we consider an interval close to our linearization point a, we can see that the results of the linear approximation are very close to the ones of the nonlinear function. For example, let’s plot both nonlinear function f(x) and linear approximation L(x) between 0.9 and 1.1.

Image: Relative error between nonlinear function and linear approximation

If we calculate the relative error between the results of the nonlinear and linear functions, we’ll notice small errors, below 0.5 %. This means that we can use our linear approximation to predict the behavior of the nonlinear function, but only around the linearization point (a, f(a)).

The Scilab instruction to plot the above graphical representations are:

// Nonlinear function
deff('y=f(x)','y=x.^3-x.^2+5');

x = [-1:.01:2];
plot(x,f(x),'LineWidth',2), xgrid()
xlabel('x','FontSize',3)
ylabel('y = f(x)','FontSize',3)
title('$\LARGE{f(x) = x^3 - x^2 + 5}$')

// Operating point (a, f(a))
a=1;
fa=f(a);
plot(a,fa,'sr')
xstring(1.05,4.6,'(1, 5)')

// Linear approximation
deff('y=L(x)','y=x+4')

figure()
hf=gcf();
ha=gca();
hf.background = -2;
ha.background = -2;
x=0.9:.01:1.1;
subplot(2,1,1)
plot(x,f(x),'LineWidth',2), xgrid()
plot(x,L(x),'m')
plot(a,fa,'sr')
xlabel('x')
ylabel('y')
legend('nonlinear function','linear approximation',2)

// Relative error
deff('y=relErr(x)','y=100-L(x)*100./f(x)')

subplot(2,1,2)
plot(x,relErr(x),'LineWidth',2), xgrid()
xlabel('x')
ylabel('Relative error [%]')

For any questions, observations and queries regarding this article, use the comment form below.

Don’t forget to Like, Share and Subscribe!

#### Ad Blocker Detected

Dear user, Our website provides free and high quality content by displaying ads to our visitors. Please support us by disabling your Ad blocker for our site. Thank you!