of 25
7/29/2019 Quadratic Equations Quadratic Equations
1/25
Solving
Equations
7/29/2019 Quadratic Equations Quadratic Equations
2/25
A quadratic equation is an equation equivalent to one of the form
Where a, b, and c are real numbers and a 0
02 cbxax
To solve a quadratic equation we get it in the form above
and see if it will factor.652 xx Get form above by subtracting 5x andadding 6 to both sides to get 0 on right side.
-5x + 6 -5x + 6
0652
xx Factor.
023 xx Use the Null Factor law and set eachfactor = 0 and solve.
02or03 xx 3x 2x
So if we have an equation inxand the highest power is 2, it is quadratic.
7/29/2019 Quadratic Equations Quadratic Equations
3/25
In this form we could have the case where b = 0.
02 cbxax
Remember standard form for a quadratic equation is:
02 cax
002 cxax
When this is the case, we get the x2 alone and then square
root both sides.
062 2 x Getx2 alone by adding 6 to both sides and then
dividing both sides by 2+ 6 + 6
62
2
x2 2 32 x
Now take the square root of both
sides remembering that you must
consider both the positive andnegative root.
3xLet's
check: 06322
06322
066 066
Now take the square root of both
sides remembering that you must
consider both the positive andnegative root.
7/29/2019 Quadratic Equations Quadratic Equations
4/25
02 cbxax
What if in standard form, c = 0?
002 bxax
We could factor by pulling
anxout of each term.
032 2 xx Factor out the commonx
032 xx Use the Null Factor law and set eachfactor = 0 and solve.
032or0 xx
2
3or0 xx
If you put either of these values in forx
in the original equation you can see it
makes a true statement.
7/29/2019 Quadratic Equations Quadratic Equations
5/25
02 cbxaxWhat are we going to do if we have non-zero values for
a, b and c but can't factor the left hand side?
0362 xxThis will not factor so we will complete the
square and apply the square root method.
First get the constant term on the other side by
subtracting 3 from both sides.36
2 xx
___3___62 xx
We are now going to add a number to the left side so it will factor
into a perfect square. This means that it will factor into two
identical factors. If we add a number to one side of the equation,
we need to add it to the other to keep the equation true.
Let's add 9. Right now we'll see that it works and then we'll look at howto find it.
9 9 6962 xx
7/29/2019 Quadratic Equations Quadratic Equations
6/25
6962 xx Now factor the left hand side.
633 xx
two identical factors
63 2 xThis can be written as:
Now we'll get rid of the square by
square rooting both sides.
63 2 xRemember you need both the
positive and negative root!
63x Subtract 3 from both sides to getxalone.
63 xThese are the answers in exact form. We
can put them in a calculator to get two
approximate answers.
55.063 x 45.563 x
7/29/2019 Quadratic Equations Quadratic Equations
7/25
Okay---so this works to solve the equation but how did we
know to add 9 to both sides?
___3___62
xx 9 9
633 xx We wanted the left hand side to factorinto two identical factors.
When you FOIL, the outer terms and theinner terms need to be identical and need
to add up to 6x.+3 x+3
x
6 x
The last term in the original trinomial will then be the middleterm's coefficient divided by 2 and squared since last term
times last term will be (3)(3) or 32.
So to complete the square, the number to add to both sides
is
the middle term's coefficient divided by 2 and squared
7/29/2019 Quadratic Equations Quadratic Equations
8/25
By completing the square on a general quadratic equation in
standard form we come up with what is called the quadratic formula.
(Remember the song!! )
a
acbbx
2
42
This formula can be used to solve any quadratic equationwhether it factors or not. If it factors, it is generally easier to
factor---but this formula would give you the solutions as well.
We solved this by completing the square
but let's solve it using the quadratic formula
a
acbbx
2
42
1
(1)
(1)
6 6 (3)
2
12366
Don't make a mistake with order of operations!Let's do the power and the multiplying first.
02 cbxax
036
2 xx
7/29/2019 Quadratic Equations Quadratic Equations
9/25
2
12366 x
2
246
626424
2
626
2
632
There's a 2 in common in
the terms of the numerator
63 These are the solutions wegot when we completed the
square on this problem.
NOTE: When using this formula if you've simplified under the
radical and end up with a negative, there are no real solutions.
(There are complex (imaginary) solutions, but that will be dealt
with in year 12 Calculus).
7/29/2019 Quadratic Equations Quadratic Equations
10/25
SUMMARY OF SOLVING QUADRATIC EQUATIONS
Get the equation in standard form: 02 cbxax
If there is no middle term (b = 0) then get thex2 alone and square
root both sides (if you get a negative under the square root there are
no real solutions).
If there is no constant term (c = 0) then factor out the commonxand use the null factor law to solve (set each factor = 0).
Ifa, band care non-zero, see if you can factor and use the null
factor law to solve.
If it doesn't factor or is hard to factor, use the quadratic formula
to solve (if you get a negative under the square root there are no real
solutions).
7/29/2019 Quadratic Equations Quadratic Equations
11/25
a
acbbxcbxax
2
40
22
If we have a quadratic equation and are considering solutions
from the real number system, using the quadratic formula, one of
three things can happen.
3. The "stuff" under the square root can be negative and we'd get
no real solutions.
The "stuff" under the square root is called the discriminant.
This "discriminates" or tells us what type of solutions we'll have.
1. The "stuff" under the square root can be positive and we'd gettwo unequal real solutions 04if 2 acb
2. The "stuff" under the square root can be zero and we'd get one
solution (called a repeated or double root because it would factor
into two equal factors, each giving us the same solution).04if
2
acb
04if2
acb
The Discriminant acb 42
7/29/2019 Quadratic Equations Quadratic Equations
12/25
13
5-2 Two-Way Selection
The decision is described to the computer as aconditional statement that can be answered either true
or false. If the answer is true, one or more action
statements are executed. If the answer is false, then a
different action or set of actions is executed.
ifelse andNull else Statement
Nested ifStatements and Dangling else Problem
Simplifying ifStatements
Conditional Expressions
Topics discussed in this section:
7/29/2019 Quadratic Equations Quadratic Equations
13/25
Computer Science: AStructured
14
FIGURE 5-6 Two-way Decision Logic
7/29/2019 Quadratic Equations Quadratic Equations
14/25
Computer Science: AStructured
15
FIGURE 5-7 if...else Logic Flow
7/29/2019 Quadratic Equations Quadratic Equations
15/25
Computer Science: AStructured
16
Table 5-2 Syntactical Rules forifelse Statements
7/29/2019 Quadratic Equations Quadratic Equations
16/25
Computer Science: AStructured
17
FIGURE 5-8 A Simple if...else Statement
7/29/2019 Quadratic Equations Quadratic Equations
17/25
Computer Science: AStructured
18
FIGURE 5-9 Compound Statements in an if...else
7/29/2019 Quadratic Equations Quadratic Equations
18/25
19
5-3 Multiway Selection
In addition to two-way selection, most programming
languages provide another selection concept known as
multiway selection. Multiway selection chooses among
several alternatives. C has two different ways toimplement multiway selection: the switch statement and
else-if construct.
Theswitch Statement
The else-if
Topics discussed in this section:
7/29/2019 Quadratic Equations Quadratic Equations
19/25
Computer Science: AStructured
20
FIGURE 5-19switch Decision Logic
7/29/2019 Quadratic Equations Quadratic Equations
20/25
Computer Science: AStructured
21
FIGURE 5-24 The else-ifLogic Design for Program 5-9
7/29/2019 Quadratic Equations Quadratic Equations
21/25
Computer Science: AStructured
22
The else-ifis an artificial C construct that is only used when
1. The selection variable is not an integral, and
2. The same variable is being tested in the expressions.
Note
7/29/2019 Quadratic Equations Quadratic Equations
22/25
General Syntax of else-if
constructif (expression-1)
statement-1;
else if (expression-2)statement-2;
..
..else
statement-n;
#i l d < tdi h>
7/29/2019 Quadratic Equations Quadratic Equations
23/25
#include
#include
#include
#include
void main()
{float a,b,c,x1,x2,disc;
clrscr();
printf("Enter the co-efficients\n");
scanf("%f%f%f",&a,&b,&c);
if(a==0)
{printf( equation is not quadratic \n);
exit(0);
}
disc=b*b-4*a*c;/*to find discriminant*/
if(disc>0) /*distinct roots*/
{x1=(-b+sqrt(disc))/(2*a);
x2=(-b-sqrt(disc))/(2*a);
printf("The roots are distinct\n");
}
7/29/2019 Quadratic Equations Quadratic Equations
24/25
else
{
x1=-b/(2*a);/*complex roots*/
x2=sqrt(fabs(disc))/(2*a);
printf("The roots are complex\n");
printf("The first root=%f+i%f\n",x1,x2);printf("The second root=%f-i%f\n",x1,x2);
getch();
}
} /* end of main function */
else if(disc==0)/*Equal roots*/{
x1=x2=-b/(2*a);
printf("The roots are equal\n");
printf("x1=%f\nx2=%f\n",x1,x2);
}
7/29/2019 Quadratic Equations Quadratic Equations
25/25