Another way to solve an equation like 2x+5=13 is to find a general formula for this equation. We can then use this formula to write a program in Python. All first-degree equations fits into this general formula: ax + b = cx + d. On each side of the equal sign, you can see an x term and a constant, which is the number with no x attached to it. The number that precedes the x variable is called a coefficient.
But sometimes there is no x term at all on one side of the equation, which means that the coefficient of that x is zero (cx = 0).
Equations like x²+3x-10 = 0 are called quadratic equations and their general form is ax²+bx+c = 0, where a, b and c can be any number: positive or negative, whole numbers, fractions or decimals. The only exception is that a can't be 0 because that can make this a first-degree equation.
Unlike first-degree equations which have one solution, quadratic equations have two possible solutions.
We can solve one root using brute force, but the x³ term means there could be as many as three solutions to this equation. To see all the possible inputs and corresponding outputs we need a graph.
Solving First-Degree Equations
-One way to solve a simple equation like 2x+5 = 13 with programming is by using brute force.