Open In App

Calculate the Discriminant Value

In algebra, Discriminant helps us deduce 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: 
 

ax^2+bx+c

Here the discriminant of the equation is calculated using the formula: 
 



b^2-4ac

Now we can deduce the following properties: 
 

Here are a few conditions that we must keep in mind while programming and making deductions from the discriminant: 
 



Examples: 
 

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

 

 

























Output: 
 

Discriminant is 100 which is Positive
Hence Two Solutions

Time Complexity: O(1) since constant operations are being performed

Auxiliary Space: O(1), since no extra space has been taken.

 


Article Tags :