# Unit-1:Roots of equation

Roots of equation in numerical methods refer to finding numerical solutions to equations where finding an analytical solution is difficult or impossible. The most commonly used methods to find the roots of equations are:

1. Bisection method
2. Newton-Raphson method
3. Secant method

## Bisection method

Bisection method is a simple and robust numerical method used to find the root of an equation. It is based on the Intermediate Value Theorem, which states that if a function is continuous on a closed interval and differentiable on the open interval, then for any value between the function’s minimum and maximum values, there exists a point at which the function is equal to that value.

Here’s an example to demonstrate the Bisection Method:

Example: Find the root of the equation x^3 – x^2 + 2 = 0 in the interval [1, 2].

Step 1: Check the function values at the endpoints. If the product of the function values at the endpoints is negative, the root lies between them.

f(1) = -2, f(2) = 4 Since f(1) * f(2) < 0, we conclude that there is a root in the interval [1, 2].

Step 2: Find the midpoint of the interval and evaluate the function at the midpoint.

x_mid = (1 + 2)/2 = 1.5 f(x_mid) = f(1.5) = -0.375

Step 3: Repeat the process by splitting the interval in two parts, depending on the sign of f(x_mid). If f(x_mid) is positive, then the root lies in the interval [1, x_mid]. If f(x_mid) is negative, then the root lies in the interval [x_mid, 2].

In this case, f(x_mid) is negative, so we repeat the process with the interval [x_mid, 2]. We keep repeating

## False Position Method

The False Position Method, also known as the Regula Falsi Method, is a root-finding method in numerical analysis that uses a succession of approximations to find a root of a function. It works similarly to the Bisection Method, but instead of using the midpoint of the interval, it uses a point determined by the intersection of the function and the line connecting the two endpoints.

Here’s an example to demonstrate the False Position Method:

Example: Find the root of the equation x^3 – x^2 + 2 = 0 in the interval [1, 2].

Step 1: Check the function values at the endpoints. If the product of the function values at the endpoints is negative, the root lies between them.

f(1) = -2, f(2) = 4 Since f(1) * f(2) < 0, we conclude that there is a root in the interval [1, 2].

Step 2: Estimate the root by using the False Position formula, which is given by: x_est = x_upper – f(x_upper) * (x_lower – x_upper) / (f(x_lower) – f(x_upper))

x_est = 2 – (4 * (1 – 2)) / (4 – (-2)) = 1.6 f(x_est) = f(1.6) = 0.512

Step 3: Repeat the process by updating either x_lower or x_upper depending on the sign of f(x_est). If f(x_est) is positive, then x_upper is updated to x_est. If f(x_est) is negative, then x_lower is updated to x_est.

In this case, f(x_est) is positive, so we update x_upper to x_est.

Step 4: Repeat steps 2 and 3 until a desired level of accuracy is reached. The iteration stops when the absolute difference between the current estimate and the previous estimate is less than a pre-specified tolerance

## Newton’s Rapheson Method

Newton-Raphson Method is a root-finding method in numerical analysis that uses an iterative approach to approximate the roots of a function. The method is based on the idea that a tangent line can be drawn to a curve at any point, and the x-intercept of the tangent line is a better approximation of the root than the original point. The method uses the first derivative of the function to find the tangent line and then finds the x-intercept of the tangent line as the next approximation of the root.

Here’s an example to demonstrate the Newton-Raphson Method:

Example: Find the root of the equation x^3 – x^2 + 2 = 0.

Step 1: Start with an initial guess for the root, say x0 = 1.

Step 2: Compute the first derivative of the function, f'(x). In this case, f'(x) = 3x^2 – 2x.

Step 3: Use the formula for Newton-Raphson iteration: x1 = x0 – f(x0) / f'(x0)

x1 = 1 – (-2 + 1^2 – 2) / (3 * 1^2 – 2 * 1) = 1.5

Step 4: Repeat the process by using x1 as the new guess for the root.

x2 = 1.5 – (-0.375 + 1.5^2 – 2) / (3 * 1.5^2 – 2 * 1.5) = 1.41667

Step 5: Repeat the process until a desired level of accuracy is reached or a maximum number of iterations is exceeded.

The Newton-Raphson Method is faster than the Bisection or False Position methods and usually converges to the root more quickly, but it may converge to a different root if the initial guess is not close enough to the actual root. Additionally, the method may also not converge if the function has a horizontal tangent or if the function’s first derivative is zero at the root.