# Tutor profile: Annie R.

## Questions

### Subject: Basic Math

Let $$ f(x) = 6x^6 - 32x^5 + 2x^4 + 3x^3 - 13x^2 - 15x + 1 $$ and $$ g(x) = 3x^2 - 16x + 1 $$ be two polynomials. Find the quotient and remainder obtained when $$ f(x) $$ is divided by $$ g(x) $$.

In order to solve this problem, we must use polynomial long division, which is quite like regular long division, except that we must take into account the division of the coefficients as well as the powers of x. First, we write down the two polynomials in decreasing order of powers of x as follows: $$ 3x^2 - 16x + 1$$ $$\overline{)\text{ }6x^6 - 32x^5 + 2x^4 + 3x^3 - 13x^2 - 15x + 1 } $$ We then find a term (for the quotient) that when multiplied by the leading term of the divisor $$g(x) $$ will eliminate the leading term of the dividend. In this case, that term would be $$ 2x^4 $$. This term is also the leading term of the quotient. Hence we multiply the rest of the terms in $$ g(x) $$ by $$ 2x^4 $$, write down the product terms under the corresponding terms of the dividend and subtract the product from the dividend as follows: $$ 2x^4 $$ $$ 3x^2 - 16x + 1$$ $$\overline{)\text{ }6x^6 - 32x^5 + 2x^4 + 3x^3 - 13x^2 - 15x + 1 } $$ $$ -(6x^6 - 32x^5 + 2x^4)$$ $$ \overline{0+ 3x^3 - 13x^2 - 15x + 1} $$ We now look at the difference obtained i.e. $$ 3x^3 - 13x^2 - 15x + 1$$. The leading term of this polynomial is $$ 3x^3 $$ and the power of $$x $$ in this term is 3, which is greater than the power of $$ x$$ in the leading term of the divisor. So we divide the difference by $$ g(x) $$ just as we did before. The term that when multiplied by $$ 3x^2 $$ (the leading term of $$g(x) $$) eliminates the leading term of the new polynomial (i.e. the difference) is $$x$$. So we add it to the quotient and multiply it by the remaining terms of $$ g(x) $$ as follows: $$ 2x^4 + x $$ $$ 3x^2 - 16x + 1$$ $$\overline{)\text{ }6x^6 - 32x^5 + 2x^4 + 3x^3 - 13x^2 - 15x + 1 } $$ $$ -(6x^6 - 32x^5 + 2x^4)$$ $$ \overline{0+ 3x^3 - 13x^2 - 15x + 1} $$ $$- ( 3x^3 - 16x^2 + x )$$ $$ \overline{0+ 3x^2 - 16x + 1} $$ Now, we are left with the difference $$ 3x^2 - 16x + 1$$, which happens to be exactly equal to the divisor $$ g(x) $$ ! This means that we can add the term 1 to the quotient, since multiplying the divisor by 1 and subtracting the product terms will eliminate the leading term of the difference. $$ 2x^4 + x + 1 $$ $$ 3x^2 - 16x + 1$$ $$\overline{)\text{ }6x^6 - 32x^5 + 2x^4 + 3x^3 - 13x^2 - 15x + 1 } $$ $$ -(6x^6 - 32x^5 + 2x^4)$$ $$ \overline{0+ 3x^3 - 13x^2 - 15x + 1} $$ $$- ( 3x^3 - 16x^2 + x )$$ $$ \overline{0+ 3x^2 - 16x + 1} $$ $$- ( 3x^2 - 16x + 1 )$$ $$ \overline{0 + 0 + 0} $$ Thus, the quotient is $$ q(x) = 2x^4 + x + 1 $$ and the remainder is $$ r(x) = 0 $$.

### Subject: Calculus

If $$ y = x^{x^{x^{x...}}} $$ (i.e. an infinite chain of powers of x), then what is $$ \frac{dy}{dx}$$ ?

Tip: In math, whenever you see an infinite chain of operations, fret not! They are some of the easiest operations to deal with :) Here consider the statement that we are given: $$ y = x^{x^{x^{x...}}} $$ (an infinite chain of powers of x) Let's think of this statement as follows: $$ y = x^B $$ where $$ B = x^{x^{x^{x...}}} $$ . But we've already been told that $$ x^{x^{x^{x...}}} $$ is equal to y. This means that $$ B = y$$ !! Thus, we can rewrite the given statement as $$ y = x^y $$. The key to note here is that if you remove one power of x in an infinite chain of powers of x, you're still left with an infinite chain of powers of x! This is because "infinity" is not actually quantifiable) Using the simplified form of the very frightening original statement, we can now proceed to find the derivative of y with respect to x by taking the logarithm of the left-hand side and the right-hand side as follows: $$ y = x^y$$ ....(1) $$ log(y )= log (x^y) $$ ....(2) $$ log (y) = y. log (x) $$ ....(3) (Power Rule of logarithms) Now, taking derivative w.r.t. $$ x $$ of equation (3), we get: $$ \frac{d(log(y))}{dx} = \frac{d(y.log(x))}{dx} $$ ....(4) $$ \frac{1}{y}. \frac{dy}{dx} = y. \frac{d(log(x))}{dx} + \frac{dy}{dx} . log(x) $$ ....(5) (Chain Rule and Multiplication Rule of derivatives) $$ \frac{1}{y}. \frac{dy}{dx} = y. \frac{1}{x} + \frac{dy}{dx} . log(x) $$ ....(6) $$ \frac{dy}{dx}. (\frac{1}{y} - log(x)) = \frac{y}{x} $$ ....(7) $$ \frac{dy}{dx}. (\frac{1 - y.log(x)}{y}) = \frac{y}{x} $$ ....(8) Hence, $$ \frac{dy}{dx} = \frac{y}{x}. \frac{y}{(1-y.log(x))} $$ Replacing $$ y $$ with $$ x^{x^{x^{x...}}} $$, we get our answer! $$ \frac{dy}{dx} = \frac{(x^{x^{x^{x...}}}).(x^{x^{x^{x...}}})}{x.(1-x^{x^{x^{x...}}}.log(x))} $$

### Subject: C Programming

Using recursion, write a C program to compute the greatest common divisor (GCD) of two natural numbers.

This question requires the understanding of two main concepts: A) Recursive functions B) GCD (Greatest Common Divisor) of two numbers A) A Recursive function is a function that calls itself during execution. The idea of recursion is to solve a large problem by a "divide and conquer" approach. The larger problem is divided into smaller subproblems. And each of those subproblems is further divided into smaller sub-problems until we identify a sub-problem that we can solve quite easily. Once we solve the simplest sub-problem, we can use it to piece together the solution to the larger sub-problems until we solve our original problem. B) The Greatest Common Divisor (GCD) of two natural numbers 'a' and 'b' is the largest number that divides both 'a' and 'b'. The most natural way to find the GCD of 'a' and 'b' is to list all the divisors of both 'a' and 'b' and then finding the largest divisor that belongs to both the lists. As you can imagine, this task becomes very difficult if 'a' and 'b' are large numbers. The best way to solve this problem is by using Euler's algorithm. Euler's algorithm is based on the following principle: "Let a and b be two numbers such that a is greater than b. Then, GCD(a, b) = GCD(a-b, b)." For example, GCD (15, 12) = GCD(3, 12) = 3 While this principle looks like a simple observation, it is actually a powerful tool. As you can see, the principle essentially solves the problem of finding the GCD of 'a' and 'b', by finding the GCD of 'a-b' and 'b'. Note that since 'a-b' is actually smaller than 'a', it would be easier to find the GCD of 'a-b' and 'b'. But we needn't stop here! We can treat 'a-b' and 'b' as new numbers and apply this same principle once more. This way, with every repetition, we will keep reducing our numbers until we reach the case where the new "a" and "b" become equal (This is the easiest sub-problem to solve!). In this case, the GCD is simply the number itself, because a number is its own greatest divisor. Consider once again the GCD of 12 and 15: GCD (15, 12) = GCD (3, 12) = GCD (3, 9) = GCD (3, 6) = GCD (3, 3) = 3 Which is the answer we expected! This solution (given below) is the perfect setup for implementing a recursive function. -------------------------------------- #include <stdio.h> // Include the console input/output header file int computeGCD (int a, int b) //We define a function to compute the GCD of two numbers { int gcd; if (a>b) //We replace the bigger number by the difference between the two a = a - b; else if (a<b) //We replace the bigger number by the difference between the two b = b -a; else //But, in case the numbers are equal, the GCD is the number itself! { gcd = a; return gcd; //In that case we output the number itself and terminate the function } /**Once we replace the bigger number with a reduced number, we call the "computeGCD" function to find the GCD of the reduced numbers! **/ computeGCD (a, b); } int main() //This is the main function where we call computeGCD() { int a, b; printf ("Enter two natural numbers a and b \n"); // We prompt the user to enter 2 nos. printf("a : "); scanf ("%d", &a); //We read user's first input and store it into a printf("b : "); scanf ("%d", &b); //We read user's second input and store it into b //We print the GCD by using the output of the function computeGCD printf ("The GCD of a and b is: %d \n", computeGCD(a,b)); return 0; }

## Contact tutor

needs and Annie will reply soon.