Exponents and Polynomials
Welcome to the second post on Basics of Algebra required for Machine Learning.
In the first post on equations, we saw
- What is algebra and an equation
- Distributive properties of an equation as well as
- The variable and Linear Equation
In this article, let’s now see some more terms of Basic Algebra such as
- Exponent
- Logarithm
- Polynomial Equation
- Factoring and
- Quadratic Equations
As always, in the end, we will know why we need to learn it and how it is used in Machine Learning. So lets begin with exponents.
Exponents
Well, in simple terms, it’s nothing but a value that answers the question of how many times we should multiply a number by itself. For example, when we have an exponent 2 for 4, we simply mean we are multiplying 4 with 4, 2 times.
2 here is also called as the index or exponent or just the power, which are the most common terms for it and 4 here is called as the base.
If we specify 3 as the exponent, we simply multiply the base by itself 3 times…. which in this case will be 64…
The exponent can take positive as well as negative values. In case of negative exponent, we divide 1 by the multiplication of the base those many times.
So here when we say -3 as the power of 4, we simply divide 1 by 4 x 4 x 4.
Similar to positive and negative values, exponent can also be zero. In that case, the value of the equation will always be 1.
So does not matter what the number is, the moment we have an exponent of zero, its value will always be 1.
Let’s now see, what happens to the exponents when we either multiply or divide them by another term with an exponent. So when we have an equation like this,
the result will be, X with an exponent that is addition of the exponents of these two values.
Similarly, when we divide two terms with exponents, we do the subtraction of the exponents.
I am sure that’s pretty straight forward and should not be a huge problem here. Next, let’s see what is the logarithm or Log as it is popularly called as.
Logarithm
We saw the following,
But if I ask you, what value of an exponent of 4 will give 64, the answer is 3.
That is nothing but taking the log of 64 with a base of 4.
Now, if I ask you what will be the answer to the followings
What essentially I am asking here is which value of the exponent of 2 will give us 4. The answer will be 2. I hope it is clear what we mean by exponent and what is the log of a number with a particular base. Let’s now see, what is known as polynomial.
Polynomial
In simple language, poly means many and nomial means term. So polynomial means an equation that has got many terms.
So let’s look at this equation here.
It has got an exponent in X-Squared, a variable in 3X and a constant of 5. There are nothing but different terms and that’s why this qualifies to be a polynomial.
Let’s now see how we can perform the arithmetic operations on the polynomials.
Arithmetic Operations on Polynomials
Let’s start with the addition. So when we are adding polynomials, we add the terms with equal exponents and of the same variable and this is how it will look like,
Remember the rule is to add the terms with equal exponents for a variable. Great. Let’s now see, how the multiplication of a polynomial is done.
Let’s assume the same two polynomials as we saw above and let’s try to multiply them.
So when do that, we multiply each and every term from the first polynomial with the each and every term of the second polynomial.
Rest of the addition will be exactly same as normal and you can proceed and do it yourself as a simple exercise of multiplying and adding the polynomials. Let’s now see another term called factoring.
Factoring
literally, factoring means, “what” can I multiply with “What” to get the required equation or number. It can be a bit confusing. So lets see an example as follows,
When we multiply 5 and 3, we get 15. So we can say that 5 and 3 are the factors of 15. Similarly, if we have this equation of,
and if we apply the distributive property, then we can take the 3 out of these two terms and re-state it as,
So now, our equation has got two factors of 3 and x + 3. Let’s just confirm the concept with one final equation.
So go through each of these steps above and you will see how we can create factors of a polynomial equation. Let’s now look at the last but not the least topic of Quadratic Equation.
Quadratic Equation
Quadratic Equations are polynomials with some special characteristics. They have quad or square as the term within the polynomial. So the quadratic equation or function will always have a structure like this,
Another important thing to note about the quadratic equations is, when we plot them on the graph, it would appear like a parabola.
Depending upon the sign at the start of the coefficient for X-Squared, you may have different shapes of parabolas.
Let’s now quickly go through some of the terms, which are used with the parabolic quadratic equations.
So as you can see, the parabola will always have a line of symmetry that divides the structure into two halves or mirror images. The point where it changes the direction is also known as the vertex of the parabola. The two points where it touches the X-Axis, are the X-intercepts of the parabola. We are now at the last section of this post and see some of the most common quadratic equations.
This almost work like a formula.
That brings us to the end of this post and in this post we saw, what is an exponent. From there, we found out what is the Log. We also learnt about polynomial with many terms, what is factoring of a number and of a polynomial equation and finally we saw what is a quadratic equation and related terms.
Why it is important to know these for Machine Learning?
Well, the exponents form the basis for polynomial and logarithmic terms. Many times, the relationship among the different input variables and the output variable is not linear, unlike Age and Grade equation, we saw in the previous post. There is a separate type of Algorithm that’s called polynomial regression for modelling such data.
Also, the formulas for many algorithms are expressed and derived in polynomial terms. Hence it is important that we understand these basic terms.
Logarithm is also used in the Classification using Logistic Regression. Also, some of the most widely used error functions within Deep Neural Networks as well as other machine learning algorithms use various Logarithmic terms. It is beyond the scope of this post to list down every formula that uses Log function. But I hope now you got an overview of these terms and will not be lost when you see them during your journey of learning Data Science and Machine Learning.
This lecture is part of my course, Complete Data Science and Machine Learning using Python where we not only go through all such mathematical concepts but also implement the Machine Learning Algorithms in depth.
Enjoy learning….