In algebra, Discriminant helps us in deducing various properties of the roots of a polynomial or polynomial function without even computing them. Let’s look at this general quadratic polynomial of degree two:
ax2 + bx + c
Here the discriminant of the equation is calculated using the formula:
b2 – 4ac
Now we can deduce the following properties:
- If the discriminant is equal to zero then the polynomial has equal roots i.e., a=b.
- If the discriminant is positive and the coefficients are real, then the polynomial has two real roots.
Here are few conditions that we must keep in mind while programming and making deductions from the discriminant:
- If the discriminant is equal to zero then one solution is possible.
- If the discriminant is positive then two solutions are possible.
- If the discriminant is negative then no real solutions are possible.
Input: a = 20 b = 30 c = 10 Explanation: (30**2) - (4*20*10) Output: Discriminant is 100 which is positive Hence Two solutions Input: a = 9 b = 7 c = 12 Explanation: (30**2) - (4*20*10) Output: Discriminant is -383 which is negative Hence no real solutions
Discriminant is 100 which is Positive Hence Two Solutions
This article is contributed by Chinmoy Lenka. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Program to calculate age
- Program to calculate value of nCr
- Program to calculate the value of sin(x) and cos(x)
- C program to calculate the value of nPr
- Program to calculate the value of nCr Efficiently
- Calculate Volume of Dodecahedron
- Efficient program to calculate e^x
- Write a program to calculate pow(x,n)
- Calculate nCr using Pascal's Triangle
- Program to calculate Profit Or Loss
- Program to Calculate the Perimeter of a Decagon
- Program to calculate Root Mean Square
- Program to calculate distance between two points in 3 D
- Calculate speed, distance and time
- Program to calculate GST from original and net prices