Solution of quadratic equations

A quadratic equation is an equation of the form: a*x^2+b*x+c=0

Where a is non-zero. Because if a is zero, then the equation becomes a linear equation. All coefficients are real numbers.

Condition

Let's solve an equation with the following coefficients:

a = input(1); b = input(7); c = input(-3)

Solution

First of all, we find the discriminant using the following formula:

D = b^2 - 4*a*c

The sign of the discriminant determines whether the equation have real roots (if the discriminant is less than zero, then Mathete considers both roots as NaN). If the discriminant is zero, the equation has one root, or in other words, two equal roots.

If the discriminant is greater than zero, then we can find its root

d = \D

Now let’s find the roots

x_1 = (-b-d)/(2*a); x_2 = (-b+d)/(2*a)

Vieta's theorem

Vieta's theorem - formulae expressing the coefficients of a polynomial in terms of its roots. In the case of a quadratic equation, the formulae are:

<<x_1+x_2=-b/a; x_1*x_2=c/a

Graphical representation

Let's construct a graph of the function f(x) = a * x2 + b * x + c . The points of intersection of the graph with the x axis will be the roots of the equation.

chart({x1: x, y1: F(x), color1: "red", type1: "line", label1: "ax^2+bx+c", x2: ([x[1], x[150]]), y2: ([0, 0]), color2: "green", type2: "line", label2: "", width: "400", height: "250", xaxis: "auto", yaxis: "auto"})

author: boris 13 sep 2010 11:47 Mathematics/Algebra show source Bookmark and Share

Comments

Only registered users can add comments (sign in)

close
wait...