JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

Polynomials, Equations, and Systems of equations

A polynomial is an expression consisting of variables or indeterminates and coefficients, that involves only the operations of addition, subtraction, multiplication, and non-negative integer exponentiation of variables. If there’s a single indeterminate x, a polynomial can always be rewritten as anxn + an-1xn-1 + an-2xn-2 + … + a1x + a0.

Fundamental polynomial operations

Remember that when you multiply two terms you must multiply the coefficients and add the exponents, e.g. 2*x2 * 5*x3 = 10*x5;

Factorization of a Polynomial

In general, if you want to factorize a polynomial, you may need to extract a common factor, e.g., x^2 + x = x(x + 1), 6*x^4 -12*x^3 +4*x^2 = 2*x^2* (3*x^2 -6*x + 2), use remarkable formulas, e.g., 25*x^2 -49 = (5*x)^2-(7)^2=(5*x-7)(5*x+7) as we are using (a+b)(a-b)=a2 -b2 or divide the polynomial between (x-a) by Ruffini method.

Ruffini

Roots of a Polynomial

The roots or zeroes of a polynomial are those values of the variable that cause the polynomial to evaluate to zero. In other words, the root of a polynomial p(x) is that value “a” that p(a) = 0.

Gnuplot is a free, command-driven, interactive plotting program. The set grid command allows grid lines to be drawn on the plot. The set xzeroaxis command draws a line at y = 0. set xrange [-5:5] and set yrange [-60:40] set the horizontal and vertical ranges that will be displayed. plot and splot are the primary commands in Gnuplot, e.g., plot sin(x)/x, splot sin(x*y/20), or plot [-5:5] x**4 -6*x**3 +5*x**2 +24*x -36, where x**4 is x4 and -6*x**3 is -6*x3.

WolframAlpha is a great tool for finding polynomial roots. It also factors polynomials and plots them.

Roots and factorization of a Polynomial with Python

vim factor.py

>>> import sympy
>>> x = sympy.Symbol('x') # SymPy variables are objects of the Symbol class.
>>> polynomial = x**4 -6*x**3 +5*x**2 +24*x -36 # polynomial = x4 -6*x3 +5*x2 +24*x -36
>>> print(sympy.solve(polynomial)) # sympy.solve algebraically solves equations and polynomials. The roots of polynomial are 
[-2, 2, 3]
>>> print(sympy.factor(polynomial)) # sympy.factor takes a polynomial and factors it into irreducible factors 
(x - 3)**2*(x - 2)*(x + 2)
>>> polynomial2 = 2*x**4+x**3-8*x**2-x+6
>>> print(sympy.solve(polynomial2))
[-2, -1, 1, 3/2]
>>> print(sympy.factor(polynomial2))
(x - 1)*(x + 1)*(x + 2)*(2*x - 3)
>>> polynomial3 = x**4-16
>>> print(sympy.solve(polynomial3))
[-2, 2, -2*I, 2*I]
>>> print(sympy.factor(polynomial3))
(x - 2)*(x + 2)*(x**2 + 4)

import numpy as np # NumPy is a library for array computing with Python
import matplotlib.pyplot as plt # Matplotlib is a plotting library for the Python programming language 
X = np.linspace(-5, 5, 50, endpoint=True) # Return evenly spaced numbers over the interval [-5, 5] as the values on the x axis.
def p(x):
        return x**4 -6*x**3 +5*x**2 +24*x -36 # This is the polynomial that we are going to plot. 
F = p(X) # The corresponding values on the y axis are stored in F.
plt.ylim([-60, 40]) # Set the y-limits on the current axes.
plt.plot(X, F) # These values are plotted using the mathlib's plot() function.
plt.show() # The graphical representation is displayed by using the show() function.

Roots and factorization of a Polynomial with Python

First-degree equations

An algebraic equation will always have an equal “=” sign and at least one unknown number or quantity, called a variable, represented by a letter (x, y, or z). Some examples of equations are 7*x = 12, 2*x + 6 = 8, x2 + 4*x + 4 = 0, etc. Solving an equation means finding the value of the unknown number, quantity or variable. The degree of an equation is the highest exponent to which the unknown or unknows are elevated.

Let’s solve the equation: A. Relocate terms: Move the terms that carry the variable “x” to the left and the numbers that do not carry “x” to the right: 2*x -x = 4 -6. Notice that a term may be moved from one member of an equation to the other member (side) provided the sign of the term is changed. B. Now simplify (or collect) the like terms: x = -2.

First-degree equations

Graphically, 2*x + 6 and x + 4 are two lines that intersect in x = -2.

A. Relocate terms: x -3*x +3*x -x = 4 + 6 - 1. B. Simplify: 0 = 9. The equation does not have a solution. It is an impossible equation. Graphically, 1 - 2*x, 10 -2*x are two parallel lines that do not intersect, and thus, there are no solutions.

First-degree equations

First-degree equations

Second-degree equations

Quadratic or second-degree equations are those where the greatest exponent to which the unknown is raised is the exponent 2.

The solution is: x = -b ± √b2 -4*a*c2*a = 5 ± √52 -4*1*62*1 = 5 ± √25 -242 = 5 ± 12. Solutions = 3, 2. expand((x-3)*(x-2)); returns x^2 -5*x +6 and its graph is a parabola. Its two roots (2, 3) are the x-intercepts of the graph (those value of x where the graph crosses or touches the x-axis).

Second-degree equations

The solution is: x = -b ± √b2 -4*a*c2*a = 8 ± √82 -4*1*162*1 = 8 ± √64 -642 = 8 ± 02. It is a double root: 4. expand((x-4)*(x-4)); returns x^2 -8*x +16 and its graph is also a parabola, but the graph does not cross the x-axis, it just touches it at x = 4.

Second-degree equations

The solution is: x = -b ± √b2 -4*a*c2*a = 0 ± √02 -4*1*42*1 = ± √-162 = ± 4i2 = ±2i. expand((x-2%i)*(x+2%i)); returns x^2 +4. There are no real roots and the graph does not cross or touch the x-axis. Its graph tells us that the roots of the equation are complex numbers.

Second-degree equations

>>> import sympy # Let's solve it in Python using SymPy
>>> x = sympy.Symbol('x')  # SymPy variables are objects of the Symbol class.
>>> equation = x**2 +4 # Define the equation x2 + 4
>>> print(sympy.solve(equation)) # sympy.solve algebraically solves equations and polynomials. The roots of the equation are: 
[-2*I, 2*I]
>>> print(sympy.factor(equation)) # We ask Python to factor our equation (x-2i)(x+2i), but fails.

import numpy as np  # NumPy is a library for array computing with Python
import matplotlib.pyplot as plt # Matplotlib is a plotting library for Python
X = np.linspace(-5, 5, 50, endpoint=True) # Return evenly spaced numbers over the interval [-5, 5] as the values on the x axis.
def p(x):
	return x**2+4 # This is the equation that we are going to plot. 
F = p(X) # The corresponding values on the y axis are stored in F.
plt.ylim([0, 30]) # Set the y-limits on the current axes.
plt.plot(X, F) # These values are plotted using the mathlib's plot() function.
plt.show() # The graphical representation is displayed by using the show() function.

Systems of equations in two variables

A system of linear equations consists of two or more equations made up of two or more variables such that all equations are considered simultaneously. A system of equations in two variables consists or comprises of two linear equations of the form
a*x + b*y = c
d*x + e*y = f
The solution to a system of linear equations in two variables is any ordered pair (x, y) that satisfies each equation independently, the point at which the lines representing the linear equations intersect.

In a system of linear equations, each equation corresponds with a line. This is a determined compatible system with one solution pair (3, 1). This is the point where the two lines (the straight lines are secant) intersect.

Systems of equations in two variables

The two lines are the same line indeed, so every coordinate pair on the line is a solution to both equations: (1, 2), (3, -1), etc. Equations in a dependent system can be derived from one another; they describe the same line, so 9*x + 6*y = 21 is basically the same than 3*x + 2*y=7. It is the result of multiplying both sides of the equation by 3.

Systems of equations in two variables

Systems of equations in two variables

user@pc:~$ python
Python 3.8.6 (default, May 27 2021, 13:28:02) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sympy 
>>> x = sympy.Symbol('x')
>>> y = sympy.Symbol('y')
>>> sympy.solve([3*x+2*y-7, 8*x-6*y+4])
{x: 1, y: 2}
>>> sympy.solve([3*x+2*y-7, 9*x+6*y-21])
{x: 7/3 - 2*y/3}
>>> sympy.solve([3*x+2*y-7, 6*x+4*y-15])
[]

Solving inequalities

An inequality is a relation that makes a non-equal comparison between two numbers or mathematical expressions, e.g., -3*x-7<2*x-5, 5*y-2>14, etc.

Solving inequalities

You can always solve the equation x^2 - 7*x -10 = (x-2)(x-5) and prove that x^2 - 7*x -10<= 0 between its roots.
(-∞, 2): x^2 - 7*x -10 > 0;
[2, 5]: x^2 - 7*x -10 <= 0;
(5, -∞): x^2 - 7*x -10 > 0

Bitcoin donation

JustToThePoint Copyright © 2011 - 2024 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun. Social Issues, Join us.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.