A root of a function

is the x value at which y is zero. In this section, we'll look at how to find roots of functions, via both closed-form solutions that generate exact answers for polynomials and iterative methods that creep up on the roots of any function.
The first step in solving an equation is determining what type of equation you have. If you have only a single polynomial (for instance, you want to find where

is equal to 9), you can express that as

and use the technique in Section 16.2.1 later in this chapter to find the value of x for which this is true, as long as the polynomial has no exponent higher than 3.
If you have a higher-degree polynomial, or a nonlinear equation,
use the Newton method described in Section 16.2.2.
If you have multiple linear equations, use Gaussian elimination, described in Section 7.12 in Chapter 7. There are many optimizations that you can make if your equations fit certain criteria, but that's beyond the scope of this book. Consult any of the sources in Section A.4 in Appendix A for more detail.
If you have multiple nonlinear equations, use the multidimensional Newton method described in Section 16.2.3 later in this chapter.
-
source