Given values a1, b1 and c1 of first Quadratic equations and values a2, b2 and c2 of second Quadratic equations , the task is to find whether both quadratic equations have common roots or not.
Input: a1 = 1, b1 = -5, c1 = 6, a2 = 2, b2 = -10, c2 = 12
Roots of both quadratic equations are (2, 3)
Input: a1 = 1, b1 = -5, c1 = 6, a2 = 1, b2 = -9, c2 = 20
Roots of first quadratic equations are (2, 3), and Roots of second quadratic equations are (4, 5)
Therefore, both quadratic equations have differnt roots.
Let the two quadratic equations are and
- Let us assume the given condition to be true, i.e. both the equations have common roots, say and
- As we know that
where a, b, c represents the quadratic equation
For 1st quadratic equation:
Similarly, for 2nd quadratic equation:
- Now since both the roots are common,
Therfore, from above equations
- Combining the above equations:
which is the required condition for both roots to be common of the two quadratic equations.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Program to find whether a no is power of two
- Program to find parity
- Find minimum number to be divided to make a number a perfect square
- Find whether a given number is a power of 4 or not
- Find Union and Intersection of two unsorted arrays
- To find sum of two numbers without using any operator
- Find day of the week for a given date
- Given a number, find the next smallest palindrome
- Find the element that appears once
- Find the largest multiple of 2, 3 and 5
- Program to find amount of water in a given glass
- Find the maximum distance covered using n bikes
- Find if two rectangles overlap
- Find the smallest number whose digits multiply to a given number n
- Find next greater number with same set of digits
- Find n'th number in a number system with only 3 and 4
- Find the missing number in Arithmetic Progression
- Find length of period in decimal value of 1/n
- Find number of days between two given dates
- Legendre's formula (Given p and n, find the largest x such that p^x divides n!)
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 Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.