You are on page 1of 13

# Numerical Computing-Solutions of Non-linear Equations

## Solutions of Non-linear Equations

1. What is an equation?
The equality of two expressions A and B
A=B
which is not an identity on the set of permissible value of the literal quantities
entering into the equality is called an equation.

## Look at these statements:

4x − 3 = 9
x 2 − 4x + 1 = 0
(a + b) 2 = a 2 + 2ab + b 2
sin 2 x + cos 2 x = 1
1
S = ut + at 2
2

## An equation with one unknown variable is a mathematical statement of the form

f ( x) = 0 where f is a function f : ℜ a ℜ . Depending on the type of the function f
equations can be classified into two main classes, namely linear and non-linear.

## 1.1. Linear Equations

Equations of the form ax + b = 0 where a ≠ 0 are called linear equations.

Examples:
3x + 5 = 0 ⇒ a = 3, b = 5
1 − 2 x = 9 ⇒ −2 x − 8 = 0 ⇒ a = (−2), b = (−8)
4 x + 3 = 3x + 1 ⇒ x + 2 = 0 ⇒ a = 4, b = 2

## University of Colombo School of Computing – March 2009 1

Numerical Computing-Solutions of Non-linear Equations

## 1.2. Non-Linear Equations

A non-linear equation has a function f that has non-linear terms of the unknown
variable x in f (x) . There are several types of non-linear functions, namely
polynomial function, trigonometric functions, rational functions, radical
functions, exponential functions, logarithmic functions.
Examples:
Polynomial function: f ( x) = an x n + an −1 x n −1 + ... + a1 x + a0 , an ≠ 0 where n is a
positive integer and an , an −1 ,..., a0 are real numbers. The degree of a polynomial is
the degree of the term of highest degree.
g ( x) = 3x 4 − x 2 + 2 x − 5
h( x ) = x 5 − 5 x 2

## Trigonometric function: function that has trigonometric terms such

as sin x, cos x, tan x, cos ecx, sec x, cot x .
Examples:
3
h( x) = sin θ −
2
g ( x) = x − 4 sin x
2

m( x) = 3 sin x + 4 cos x − 1

## Rational function: quotient of two polynomials is defined as a rational function. It

f ( x)
is of the form where g ( x) ≠ 0
g ( x)
Examples:
4x + 3
f ( x) =
x +1
1
h( x ) = 2
x +3
( x − 4) 2
m( x ) =
( x + 1)( x − 6)

## University of Colombo School of Computing – March 2009 2

Numerical Computing-Solutions of Non-linear Equations

Examples:
g ( x) = x + 2
h( x ) = x − 2
f ( x) = 3 x 2 − 3 x + 7 − 2 x

Exponential function: functions that can be expressed in the form b x , where b > 0
and b ≠ 1 is called exponential function

Examples:
f ( x) = 5 x
h( x ) = e − x
nt
 r
A = P 1 + 
 n
A = Pe nt

## Logarithmic function: inverse of exponential function is called the logarithmic

function, for all positive real numbers x and b , b > 0 and b ≠ 1 , y = log b x if and
only if x = b x

Examples:
f ( x) = log 7 x
h( x) = ln x + 2.2
g ( x) = log10 ( x + 10)

## 2. How do we solve equations?

It is important to solve equations. They can be solved in different ways as given
below:
2.1. Analytical Method
2.1.1. Use general characteristics of the equation
2.1.1.1. Linear Equations
f ( x) = ax + b = 0
b
x = − ,a ≠ 0
a
f ( x) = ax 2 + bx + c = 0
− b ± b 2 − 4ac
x=
2a

## University of Colombo School of Computing – March 2009 3

Numerical Computing-Solutions of Non-linear Equations

Depend upon the value of the discriminator ( b 2 − 4ac ) the equation can
have 2, 1 or 0 real roots.

2.1.1.3.Cubic Equations
f ( x) = ax3 + bx 2 + cx + d = 0
f ( x) = ( Ax + B)(Cx 2 + Dx + E ) = 0
B − D ± D 2 − 4CE
x = − , or x = −
A 2C
Cubic equation has at least one real solution.

2.1.1.4.Quartic Equations

2.1.1.5.Quntic Equations
It has been shown that a general solution cannot be given to polynomial
equations of order 5 or higher. (See Abel–Ruffini theorem)

## 2.1.1.6. Trigonometric Equations

There are two types of equations, namely identities and conditional
equations. Equations that are true for all the variables for which the
equation is defined are identities. Equations that are true for at least one
value of the variable, but not all the values, are called conditional
equations.

Example:
1 + sin x = 2 is a conditional equation since it is true for some
3π π 5π
values of x such as − , , and but it is false for x = 0 and
2 2 2
x =π.
sin 2 x + cos 2 x = 1 is an identity as it is true for all x ∈ ℜ

## When solving trigonometric equations, identities are used to transform

the equation into a simple form.

## University of Colombo School of Computing – March 2009 4

Numerical Computing-Solutions of Non-linear Equations

## General solutions for standard trigonometric equations:

sin x = sin α
x = nπ + (−1) n α , n ∈ Ζ

cos x = cos α
x = 2nπ ± α , n ∈ Ζ

tan x = tan α
x = π +α,n ∈ Ζ

## Solve sin x + cos x = 1

sin x + cos x = 1
sin x = 1 − cos x
sin 2 x = (1 − cos x) 2
1 − cos 2 x = 1 − 2 cos x + cos 2 x
2 cos 2 x − 2 cos x = 0
2 cos x(cos x − 1) = 0
2 cos x = 0 or cos x − 1 = 0
cos x = 0 or cos x = 1
π
cos x = cos or cos x = cos 0
2
π
x = 2 nπ ± or x = 2nπ , n ∈ Ζ
2

## University of Colombo School of Computing – March 2009 5

Numerical Computing-Solutions of Non-linear Equations

2.1.2. Factorization
Expressing the function f in terms of its factors help finding roots of the
equation f ( x) = 0 .
Zero-Product Property: for all real numbers a and b , ab = 0 if and only
if a = 0 or b = 0
Even though polynomial equations of order 5 or higher do not have
general solutions, factorization helps finding roots for special cases, see
example below:

f ( x) = 2 x 2 + 11x + 15 = 0
f ( x) = ( x + 3)(2 x + 5) = 0
−5
x = −3 or x =
2

h( x ) = x 5 − 5 x 3 + 4 x = 0
h( x) = x( x − 2)( x − 1)( x + 1)( x + 2) = 0
x = 0 or x = 2 or x = 1 or x = −1 or x = −2

## 2.2. Graphical Method

Another useful way to obtain approximate solution for equations especially for
higher order polynomials ( order ≥ 5) is sketching the function on a grid and
discovering the points where the curve crosses the x-axis, because f ( x) = 0 on
the x-axis. This cab be done manually or by using a software package or by using
a calculator.

## University of Colombo School of Computing – March 2009 6

Numerical Computing-Solutions of Non-linear Equations

## The graph of the function f ( x) = 2 x 2 + 3x − 5 has been plotted on the 2-

dimentional grid. It can be seen clearly that the curve cuts the x-axis at x = −2.5
and x = 1 .

f ( x) = 2 x 2 + 3 x − 5

The solutions obtained in this manner are approximate and the precision is
constraints by the precision of the graphical representation.
This method can be used to get a sense of where the roots are, approximately,
and how many real roots exist.

If there are two values of x, for example a and b such that f (a ) and f (b) have
opposite values then it can be concluded that there is at least one solution (root)
between a and b. This is true only for continuous functions. (see Intermediate
Value Theorem)

## Suppose f : [a, b] a ℜ and f is continuous. If u ∈ ℜ and satisfies

f (a ) < u < f (b) or f (a ) > u > f (b) then for some c ∈ [a, b ] f (c) = u . The
diagram below illustrates the theorem graphically.

## University of Colombo School of Computing – March 2009 7

Numerical Computing-Solutions of Non-linear Equations

## 2.3. Numerical Method

Numerical methods are used when an analytical solution does not exist or finding
such a solution is difficult. When compared with graphical methods, numerical
methods can be used to obtained approximate solution with high precision or in
other words error is significantly low.

All the numerical methods used to find roots of non-linear equation use
Intermediate Value Theorem as the underline principle which means they first
identify an [a, b ] on the x-axis that give opposite signs for f (a ) and f (b) that
guarantees the existence of a point c such that c ∈ [a, b ] and f (c ) = 0 .

Two diagrams below shows how an initial guess is found with in the interval
[a, b] and then how a better approximation is found within the same interval.

## University of Colombo School of Computing – March 2009 8

Numerical Computing-Solutions of Non-linear Equations

## 3. Solutions for non-linear equations

3.1. Roots (solutions) of an equation
A root of an equation is the value that satisfies the condition f ( x) = 0 . This
called a solution of the equation f ( x) = 0 or a zero of the function f .
3.2. Existence and uniqueness
We have seen that solving non-linear equations is more complicated than for
linear equation.
Non-linear equation can have any number of solutions.
 exp(−x) + 1 = 0 has no solution
 exp(− x) − x = 0 has one solution
 x 2 − 4 sin x = 0 has two solutions
 x 3 + 6 x 2 + 11x − 6 = 0 has three solutions
 sin x = 0 has infinitely many solutions

## 3.3. Number of solutions and multiplicity

When a given factor ( x − r ) occurs m times in a polynomial, r is called a
multiple root or a root of multiplicity m .
 If m is even, the graph touches the x-axis at x = r , but does not cross it.
 If m is odd, the graph crosses x-axis at x = r , and it is horizontal at the
point where it crosses the x-axis.

## University of Colombo School of Computing – March 2009 9

Numerical Computing-Solutions of Non-linear Equations

4. Bisection Method
Bisection method begins with initial bracket and repeatedly halves its length until
solution has been isolated as accurately as desired.

1. Start with an initial range [a, b] , and cut the range in half, assume this half
point m is the root
2. Evaluate the error err = f (m) .
3. if error is too big, decide if the root is to the left or right of [m] .
• If root is to the left of m , reassign a new range a = a, b = m
• Else if root is to the right of m , reassign a new range
a = m, b = b

## University of Colombo School of Computing – March 2009 10

Numerical Computing-Solutions of Non-linear Equations

## Example of Bisection Method:

 Bisection method does not use magnitude of function values but only their
values.
 Though this method guarantees convergence, it is slow.
 At each iteration, the length of the interval containing solution is reduced by
half, the convergence rate is linear.
 One bit of accuracy is gained in approximate solution for each iteration of
bisection.
 Given the starting interval [a, b ] , length of interval after k iterations
(b − a)   b − a 
is k
, so achieving error tolerance of tol requires log 2  
2   tol 
iterations, regardless of function f involved.

## University of Colombo School of Computing – March 2009 11

Numerical Computing-Solutions of Non-linear Equations

## 5. Netwon’s Method (Newton Raphson Method)

This method uses the derivative f ' ( x) of the function f being solved.
1. Pick a single point (not a range) as an initial guess x1
2. Evaluate the error err = f ( x1 )
3. Next guess – draw tangent line from initial guess to the x-axis. New guess, x2 ,
is the intersection of the tangent line with the x-axis.
4. Back to step 2 to evaluate error of new guess, … etc

## Tangent line (slope) is given by the first derivative of f (x)

General formula for next guess xk +1 in terms of previous guess xk
f ( xk )
new guess xk +1 = xk −
df ( xk ) / dx
this is from the definition of slope:

df ( xk ) 0 − f ( xk )
slope = = , solve for xk +1
dx xk +1 − xk

## University of Colombo School of Computing – March 2009 12

Numerical Computing-Solutions of Non-linear Equations

 Newton’s Method quickly converges to the root under the ‘right’ conditions.
 Function must be differentiable.
 It can be divergent if initial guess not close to the root.