tag:blogger.com,1999:blog-12436121906667373382021-11-09T23:38:13.031+02:00Various notes on math and programmingpetrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.comBlogger31125tag:blogger.com,1999:blog-1243612190666737338.post-58185732258751013072021-10-19T09:25:00.029+03:002021-10-26T01:23:55.830+03:00Inverse of a matrix<p>All matrices we talk about here are $n \times n$ square matrices over a numeric field.&nbsp;&nbsp;</p><p>In linear algebra the definition of the concept <b>invertible matrix </b>is usually given this way.&nbsp;</p><p><b>Def.:</b> A matrix is said to be <b>invertible</b> if there exists a matrix B such that $AB=BA=I$ where I is the identity matrix. In this case <b>B</b> is called the inverse matrix of <b>A</b>.</p><p>But I somehow don't like this definition, it seems too strong to me since it implies B is both left inverse (meaning $BA=I$) and right inverse (meaning $AB=I$) of the matrix A.</p><p>So let us try to introduce this concept in a somewhat different way.</p><p><b>Def.1:&nbsp;</b>A matrix is said to be&nbsp;<b>left&nbsp;invertible</b>&nbsp;if there exists a matrix B such that $BA=I$ where I is the identity matrix. In this case&nbsp;<b>B</b>&nbsp;is called <b>left inverse</b> matrix of&nbsp;<b>A</b>.</p><p><b>Def.2:&nbsp;</b>A matrix is said to be&nbsp;<b>right&nbsp;invertible</b>&nbsp;if there exists a matrix B such that $AB=I$ where I is the identity matrix. In this case&nbsp;<b>B</b>&nbsp;is called <b>right&nbsp;inverse</b>&nbsp;matrix of&nbsp;<b>A</b>.</p><p>We still don't know if left/right inverses of a matrix A exist and under what conditions. We also don't know if they are unique (in case they exist).&nbsp;</p><p>Now we will prove a few statements to clarify all this.&nbsp;</p><p><b>Th1: </b>If a matrix A is left (or right) invertible then $\det (A) \ne 0$&nbsp;&nbsp;</p><p><b>Proof: </b>We know that $\det (XY) = \det(X) \cdot \det(Y)$&nbsp;</p><p>If A is left invertible then there exists a matrix B such that $BA = I$. But then $1 = \det(I) = \det(BA) = \det(B) \cdot \det(A)$ And now it follows that $\det(A) \ne 0$&nbsp;&nbsp;</p><p>If A is right invertible then there exists a matrix B such that $AB = I$. But then $1 = \det(I) = \det(AB) = \det(A) \cdot \det(B)$ And now again it follows that $\det(A) \ne 0$&nbsp;&nbsp;</p><p><b>Th2:</b> If $\det(A) \ne 0$ then A is left and right invertible.&nbsp;</p><p><b>Proof: </b>The proof here is done by construction. If $A=(a_{ij})$, we construct the matrix $S=(A_{ji})$ which is the matrix formed by <b>the cofactors</b> of $A$ <b>transposed</b>. Then one easily shows (using previous theory from linear algebra) that the matrix $T = \frac{1}{\det(A)} \cdot S$ satisfies both $TA=I$ and $AT=I$&nbsp;</p><p>So far we proved that a matrix A is left/right invertible <b>if and only if </b>$\det(A) \ne 0$ In the case when $\det(A) \ne 0$, we also showed how one <b>left inverse</b> and one <b>right inverse</b> can be constructed i.e. we showed <b>existence of the left/right inverses</b> (the matrix T is both left and right inverse of A).&nbsp;</p><p>This construction of $T$ (from $A$) is important so we will keep denoting this so-constructed matrix as $T$ for the rest of this post.&nbsp;</p><p><b>Th3: </b>For each matrix $A$ with&nbsp;$\det(A) \ne 0$ there is a unique left inverse and a unique right inverse and they are both equal to the above constructed matrix $T$.&nbsp;&nbsp;</p><p><b>Proof: </b>Let's assume that $BA=CA=I$ for some matrices $B,C$ - left inverses of $A$.&nbsp;</p><p>Then $T=IT=(BA)T=B(AT)=BI = B$&nbsp;&nbsp;</p><p>And also $T=IT=(CA)T=C(AT)=CI = C$&nbsp;&nbsp;</p><p>OK, so it follows that $B=C$ (and both B and C are equal to that special matrix T). This proves the uniqueness of the <b>left inverse</b>.&nbsp;</p><p><b>Note that to prove the uniqueness of the left inverse we used the existence of the right inverse T of A.&nbsp;</b></p><p>The uniqueness of the <b>right&nbsp;inverse&nbsp;</b>is proved in the same way.&nbsp;&nbsp;</p><p>Let's assume that $AB'=AC'=I$ for some matrices $B',C'$ - right inverses of $A$.&nbsp;</p><p>Then $T=TI=T(AB')=(TA)B'=IB' = B'$&nbsp;&nbsp;</p><p>Also&nbsp; $T=TI=T(AC')=(TA)C'=IC' = C'$&nbsp;&nbsp;</p><p>So it follows that $B'=C'$ (and both B' and C' are equal to that special matrix T). This proves the uniqueness of the&nbsp;<b>right inverse</b>.&nbsp;</p><p><b>Note that to prove the uniqueness of the right inverse we used the existence of the left inverse T of A.&nbsp;</b></p><p>We are done. Now we have everything introduced in a clear way. We proved that A is left/right invertible if and only if its determinant is non-zero. And we proved that in that case (when the determinant is non-zero) the left/right inverses exists (T), and also that they are unique and coincide (both are equal to T).&nbsp;</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-24532368838308873072021-10-03T22:49:00.020+03:002021-10-03T23:18:56.841+03:00Elementary row/column operations on matrices<p>The elementary row/column operations on matrices are:</p><p>1) Multiplying the $i$-th row (column) by a number $\lambda \ne 0$.</p><p>$R_i := \lambda \cdot R_i$</p><p>2) Adding the $j$-th row/column multiplied by a number $\lambda$ to the $i$-th row/column.</p><p>$R_i := R_i + \lambda \cdot R_j$</p><p>3) Exchanging the rows/columns $i$ and $j$.</p><p>$R = R_i$</p><p>$R_i = R_j$</p><p>$R_j = R$</p><p>The interesting thing is that <b>for square matrices</b> each of these operations can be accomplished by matrix multiplication.</p><p>Let us define:&nbsp;</p><p></p><ul style="text-align: left;"><li>$E$ - the identity matrix of order $n \times n$.</li><li>$E_{ij}$ - the square matrix of order $n \times n$ which has an element $1$ at position $(i, j)$ and zeroes at all other positions.</li><li>$A$ - any square matrix of order $n \times n$.</li></ul><p></p><p>Then one can show that:</p><p>(1) Multiplying the i-th <b>row/column</b> of A by the number $\lambda \ne 0$ is accomplished by&nbsp;<b>left/right&nbsp;</b>multiplying A with the matrix $A_i(\lambda) = E + (\lambda-1)E_{ii}$</p><p>(2A) Adding the $j$-th <b>row </b>multiplied by a number $\lambda$ to the $i$-th <b>row </b>is accomplished by <b>left </b>multiplying A with the matrix $B_{ij}(\lambda) = E + \lambda E_{ij}$</p><p>(2B) Adding the $j$-th <b>column </b>multiplied by a number $\lambda$ to the $i$-th <b>column</b> is accomplished by&nbsp;<b>right&nbsp;</b>multiplying A with the matrix $B_{ji}(\lambda) = E + \lambda E_{ji}$</p><p>(3) Exchanging the <b>rows/columns</b> $i$ and $j$ is accomplished by <b>left/right </b>multiplying A with the matrix $C_{ij} = E - E_{ii} - E_{jj} + E_{ij} + E_{ji}$</p><p>The matrices $A_i(\lambda), B_{ij}(\lambda), C_{ij}$ are usually called <b>matrices of the elementary transformations</b>.</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-16127768700507190852021-09-23T12:54:00.028+03:002021-09-25T21:32:22.201+03:00Rank of a system of vectors<p>Let $V\$ be a vector space and let</p><p>$$b_1, b_2, \dots, b_n \tag{1}$$ be a system (multiset) of vectors from $V$</p><p>(multiset because the vectors $b_i$ are not required to be distinct).</p><p><b><u>Definition:</u>&nbsp;</b></p><p>a) We will say that the system $(1)$ has rank $r \in \mathbb{N}$ if there exist $r$ linearly independent vectors from $(1)$, and every other vector from $(1)$ can be represented as a linear combination of these $r$ vectors.&nbsp;</p><p>b) We will say that the system $(1)$ has rank $0$ if $b_i = 0$ (the zero vector) for every $i=1,2,\dots, n$.</p><p>The rank of the system of vectors $(1)$ is denoted by $r(b_1, b_2, \dots, b_n)$.</p><p><u><b>Proposition 1:</b></u>&nbsp;The rank of the system $(1)$ is equal to the maximal number of linearly independent vectors in the system $(1)$</p><p><u><b>Proposition 2:</b></u>&nbsp;$r(b_1, b_2, \dots, b_n) = \dim\ \textbf{span}(b_1, b_2, \dots, b_n)$</p><p><u><b>Proposition 3:</b></u>&nbsp;If $r(b_1, b_2, \dots, b_n)=r$ and $b$ is a vector, then $\ r(b_1, b_2, \dots, b_n, b) = r\$ or $\ r(b_1, b_2, \dots, b_n, b) = r + 1\$</p><p>More specifically:&nbsp;</p><p><b>A)</b> $r(b_1, b_2, \dots, b_n, b) = r(b_1, b_2, \dots, b_n)$&nbsp;</p><p><b>if and only if&nbsp;</b>$b$ is a linear combination of the vectors $b_i$</p><p><b>B)</b> $r(b_1, b_2, \dots, b_n, b) = r(b_1, b_2, \dots, b_n) + 1$&nbsp;</p><p><b>if and only if&nbsp;</b>$b$ is not a linear combination of the vectors $b_i$</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-57441548356513476812021-08-25T12:40:00.024+03:002021-08-25T13:10:08.750+03:00Algebra Notes 3<p><b>3.1) Permutations</b></p><p>Every ordering of the first <b>n</b> natural numbers $1,2,\dots,n$ is called a permutation.</p><p>There are $n!$ permutations of the first <b>n</b> natural numbers.</p><p><b>3.2) Inversions</b></p><p>If we have the permutation $i_1, i_2, \dots i_n$ (of the first <b>n</b> natural numbers) then the numbers $i_k$ and $i_s$ are said to form an <b>inversion</b> if $k \lt s$ but $i_k &gt; i_s$</p><p>In other words, an <b>inversion</b> in a permutation is a pair of numbers such that the larger number appears to the left of the smaller one in the permutation. The <b>inversion number</b> of a permutation is the total number of inversions. The inversion number of the permutation $i_1, i_2, \dots i_n$ is denoted by $[i_1, i_2, \dots ,i_n]$.</p><p><b>3.3) Parity of a permutation</b></p><p>Odd permutations - the inversion number is odd</p><p>Even permutations - the inversion number is even</p><p><b>3.4) Sign of a permutation</b></p><p>The sign of a permutation $i_1, i_2, \dots i_n$ is defined as $(-1)^{[i_1, i_2, \dots ,i_n]}$, where $[i_1, i_2, \dots ,i_n]$ is the <b>inversion number</b> of the permutation. It is obvious that the sign is $+1$ for even permutations and $-1$ for odd permutations.</p><p><b>3.5) Transposition</b></p><p>We say that we have applied a <b>transposition</b> if in a permutation <b>P</b> we swap the order of any two elements and the other elements we leave in place. When we do this, we get (from <b>P</b>) a new permutation <b>R</b>.</p><p><u>Lemma 1</u>: The permutations <b>P</b> and <b>R</b> are of different parity.</p><p><u>Lemma 2</u>: When $n \ge 2$, the number of the even permutations is equal to the number of the odd permutations.</p><p><b>3.6) Determinant</b></p><p>The concepts introduced here are important building blocks for introducing the concept of&nbsp;<a href="https://en.wikipedia.org/wiki/Determinant" target="_blank">determinant</a> (of a square matrix). The concept of determinant is usually defined using the&nbsp;<a href="https://en.wikipedia.org/wiki/Leibniz_formula_for_determinants" target="_blank">Leibniz formula for determinants</a></p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-18375858471624030562021-08-25T11:20:00.032+03:002021-10-03T01:15:55.059+03:00Algebra Notes 2<p><b>2.1) Systems of linear equations</b></p><p>$a_{11}x_1 + a_{12}x_2 + \dots + a_{1n}x_n = b_1$</p><p>$a_{21}x_1 + a_{22}x_2 + \dots + a_{2n}x_n = b_2$</p><p>$\dots$</p><p>$a_{m1}x_1 + a_{m2}x_2 + \dots + a_{mn}x_n = b_m$</p><p>This is a system of <b>m</b> linear equations with <b>n</b> unknowns.&nbsp;</p><p>a) The <b>matrix </b>of this system is defined as follows</p><p>$$A = \begin{bmatrix}a_{11}&amp;a_{12}&amp;...&amp;a_{1n}\\a_{21}&amp;a_{22}&amp;...&amp;a_{2n}\\...&amp;...&amp;...&amp;...\\a_{m1}&amp;a_{m2}&amp;...&amp;a_{mn}\end{bmatrix}$$</p><p><b><i><span style="color: #3d85c6;">На български: матрица на системата</span></i></b></p><p>b) The&nbsp;<b>augmented&nbsp;</b><b>matrix&nbsp;</b>of this system is defined as follows</p><p>$$B = \begin{bmatrix}a_{11}&amp;a_{12}&amp;...&amp;a_{1n}&amp;b_1\\a_{21}&amp;a_{22}&amp;...&amp;a_{2n}&amp;b_2\\...&amp;...&amp;...&amp;...&amp;...\\a_{m1}&amp;a_{m2}&amp;...&amp;a_{mn}&amp;b_m\end{bmatrix}$$</p><p><b><i><span style="color: #3d85c6;">На български: разширена матрица на системата</span></i></b></p><p><b><br /></b></p><p><b>2.2) Types of systems of linear equations</b></p><p>a) Independent system: has exactly one solution</p><p>b) Inconsistent system: has no solutions</p><p>c) Consistent system: has at least one solution</p><p>d) Dependent system: has infinitely many solutions</p><p><br /></p><p><i>a) Определена система: има точно едно решение</i></p><p><i>b) Несъвместима система: няма решения</i></p><p><i>c) Съвместима систeмa: има поне едно решение</i></p><p><i>d) Неопределена система: има безбройно много решения</i></p><p><br /></p><p><b>2.3) Elementary transformations applied to a system of linear equations</b></p><p>a) swapping two rows</p><p>b) multiplying a row of the system with a non-zero number</p><p>$R := \lambda R$, where $\lambda \neq 0$&nbsp;</p><p>c) adding to a row another row (multiplied by a number)</p><p>$R_2 := R_2 + \lambda R_1$</p><p><i><b>Note: </b>If we apply (to a given system of linear equations) a finite number of elementary transformations, the resulting system is equivalent to the original system.</i></p><p><i><br /></i></p><p><b>2.4) Gaussian elimination - a general method for solving systems of linear equations</b></p><p><a href="https://en.wikipedia.org/wiki/Gaussian_elimination" target="_blank">Gaussian elimination</a><br /></p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-5549840239441916082021-02-27T11:54:00.020+02:002021-04-15T13:17:02.016+03:00Sufficient conditions for integrability<p>This post is about single variable functions $f : [a, b] \to \mathbb{R}$ defined in a <b>finite closed interval</b>, and about some sufficient conditions for their&nbsp;<a href="https://en.wikipedia.org/wiki/Integrability" target="_blank">integrability</a>&nbsp;in the interval $[a, b]$. Here $a$ and $b$ are real numbers of course.</p><p>Integrability refers to the existence of the definite integral&nbsp;</p><p>$$\int\limits_a^b f(x)\,dx$$</p><p>One should note that there are different definitions of integrability (i.e. different definitions of the definite integral shown above).</p><p>The one I am referring to here is Darboux integrability. This one is equivalent to Riemann integrability.&nbsp;</p><p>Then there is also Lebesgue integrability which allows a wider family of functions to be classified as <b>integrable</b>. So all functions which are Darboux/Riemann integrable are also Lebesgue integrable but the converse is not true. This is a very interesting topic and relates to measure theory.</p><p>OK... so here are several sufficient conditions for Darboux/Riemann integrability.&nbsp;</p><p><u><b>Theorem 1</b></u>: If the function $f : [a, b] \to \mathbb{R}$ is <b>defined </b>and&nbsp;<b>continuous </b>in the <b>finite closed interval</b> $[a,b]$, it is <b>integrable </b>in $[a,b]$.&nbsp;</p><p><u><b>Theorem 2</b></u>: If the function $f : [a, b] \to \mathbb{R}$ is <b>defined </b>and&nbsp;<b>bounded&nbsp;</b>in the <b>finite closed interval</b> $[a,b]$,&nbsp;and if it is <b>discontinuous only at a finite number of points</b>, then it is <b>integrable </b>in $[a,b]$.&nbsp;</p><p><b><u>Theorem 3</u></b>: If the function $f : [a, b] \to \mathbb{R}$ is <b>defined </b>and <b>monotonic </b>in the&nbsp;<b>finite closed interval</b> $[a,b]$, then it is <b>integrable </b>in $[a,b]$.</p><p>Note that the last theorem does not disallow a situation where $f$ has <b>infinitely many points of discontinuity</b>. That situation is allowed and the function if still integrable (provided that it's monotonic, as the theorem says).</p><p>Again, it should be pointed out that these are just <b>sufficient </b>conditions for integrability, they are not <b>necessary</b>. There are functions which do not satisfy the conditions of any of these three theorems but are still integrable.&nbsp;</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-25306273445948876192021-02-21T13:30:00.058+02:002021-02-26T11:32:29.113+02:00Algebra Notes 1<p><u>1.1) Fundamental theorem of algebra (D'Alembert)</u>:&nbsp;</p><p>Every non-zero, single-variable, degree $n$ polynomial with complex coefficients has, counted with multiplicity, exactly $n$ complex roots.&nbsp;</p><p>For more details see&nbsp;<a href="https://en.wikipedia.org/wiki/Fundamental_theorem_of_algebra" target="_blank">here</a></p><p><u>1.2) Number field definition (A):</u></p><p>Let $F$ be a subset of $\mathbb{C}$ which contains at least two elements. We say that $F$ is a <b>number field</b> if the following conditions are met:&nbsp;</p><p>a) if $z_1$ and $z_2$ are arbitrary numbers from $F$, then the numbers $z_1 + z_2$, $z_1 - z_2$, $z_1 \cdot z_2$ are also in $F$,&nbsp;</p><p>b) if $z_1$ and $z_2$ are arbitrary numbers from $F$ and $z_2 \ne 0$, then $z_1 / z_2$ is also in $F$.&nbsp;</p><p><u>1.3) Number field definition (B):</u></p><p>Let $F$ be a subset of $\mathbb{C}$ which contains at least two elements. We say that $F$ is a <b>number field</b> if the following conditions are met:&nbsp;</p><p>a) if $z_1$ and $z_2$ are arbitrary numbers from $F$, then the numbers $z_1 + z_2$, $z_1 - z_2$, $z_1 \cdot z_2$ are also from $F$;&nbsp;</p><p>b) if $z \in F$ and $z \ne 0$, then $z^{-1} \in F$&nbsp;</p><p><u>1.4) Note:</u> Not all fields in mathematics are considered number fields (e.g. <a href="https://en.wikipedia.org/wiki/Finite_field" target="_blank">finite Galois fields</a> are not considered number fields). The number sets $\mathbb{Q}, \mathbb{R}, \mathbb{C}$ (equipped with the usual algebraic operations) are number fields. The number sets $\mathbb{N}, \mathbb{Z}$ are not number fields.</p><p><u>1.5) Theorem:</u> Every number field is a superset of the field of the rational numbers $\mathbb{Q}$.</p><p><u>1.6) Notations:</u>&nbsp;</p><p>a) $F_{m \times n}$ - the set of all $m \times n$ matrices with elements from the number field $F$</p><p>b) $M_{n}(F)$ - the set of all $n \times n$ square matrices with elements from the number field $F$; these are also called square matrices of order $n$&nbsp;</p><p>c) If $A = (a_{ij})_{m\times n}$ is a matrix, then by $A^t$ we denote the transposed matrix of the matrix $A$; it is defined as follows: $A^t = (a_{ji})_{n\times m}$&nbsp;</p><p>d) $E_n$ or just $E$ is the <a href="https://en.wikipedia.org/wiki/Identity_matrix" target="_blank">identity matrix</a> ($E_n$ just emphasizes the fact that the order of the matrix is $n$)</p><p>e) $E_{ij}$ is the matrix from $F_{m \times n}$ which has element $1$ at position $(i,j)$ and zero elements at all other positions $(k,l) \ne (i,j)$</p><p><u>1.7) Operations on matrices:</u></p><p>a) sum of matrices: $A+B$</p><p>b) multiplication of a matrix with a number: $\lambda A$</p><p>c) transposed matrix: $A^t$</p><p><u>1.8) Property:</u></p><p>Obviously if $A = (a_{ij})_{m\times n}$ is an arbitrary matrix from $F_{m \times n}$ then $$A = \sum_{i=1}^{m} \sum_{j=1}^{n} a_{ij} \cdot E_{ij}$$</p><p><u>1.9) Definition:</u>&nbsp;&nbsp;</p><p>a) The matrices which have a single row (or a single column) are called <b>row matrices </b>(or <b>column matrices</b>),<b> </b>or&nbsp;<b>n-tuples,&nbsp;</b>or also <b>n-dimensional&nbsp;vectors</b>.</p><p>b) The set of all <b>n-tuples </b>with elements from the number field $F$ is denoted by $F^n$&nbsp;</p><p>c) The <b>n-tuples&nbsp;&nbsp;</b></p><p>$e_1 = (1, 0, 0, \dots, 0, 0),\ e_2 = (0, 1, 0, \dots, 0, 0),\ e_3 = (0, 0, 1, \dots, 0, 0),\ \dots\ ,\$&nbsp;</p><p>$e_{n-1} = (0, 0, 0, \dots, 1, 0),\ e_{n} = (0, 0, 0, \dots, 0, 1)$&nbsp;</p><p>are called <b>unit vectors </b>or <b>unit&nbsp;</b><b>n-dimensional vectors</b>.</p><p><u>1.10) Note:</u> If $a = (a_1, a_2, \dots, a_n) \in F^n$ then obviously $a = a_1 e_1 + a_2 e_2 + \dots + a_n e_n$ This expression for $a$ is called a <b>linear combination</b>. In this particular case, $a$ is linear combination of the unit vectors $e_1, e_2, \dots, e_n$&nbsp;</p><p><u>1.11) Properties of the transposed matrix:</u></p><p>a) $(A^t)^t = A$&nbsp;</p><p>b) $(A+B)^t = A^t + B^t$&nbsp;</p><p>c) $(\lambda A)^t = \lambda A^t$ (for any $\lambda \in F$)</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-70711200986105058092021-02-18T10:40:00.062+02:002021-02-18T12:09:35.719+02:00A nice symmetric system of linear equations<div><div>Suppose we want to solve the following system of linear equations in which $a$ and $b_i$ are real parameters.&nbsp;</div></div><div><br /></div><div>$$ax_1 + ax_2 + \dots + ax_{n-1} + (a+1)x_n = b_1$$</div><div>$$ax_1 + ax_2 + \dots&nbsp;+ (a+1)x_{n-1} + ax_n = b_2$$</div><div>$$\dots$$</div><div>$$(a+1)x_1 + ax_2 + \dots&nbsp;+ ax_{n-1} + ax_n = b_n$$</div><div><br /></div><div>We can proceed as follows.</div><div><br /></div><div>Denote&nbsp;</div><div><br /></div><div>$$T = \sum_{i=1}^n b_i$$</div><div>$$S = \sum_{i=1}^n x_i$$</div><div><br /></div><div>Then the given system of equations can be rewritten as&nbsp;</div><div><br /></div><div>$$aS + x_n = b_1$$</div><div>$$aS + x_{n-1} = b_2$$</div><div>$$\dots$$</div><div>$$aS + x_2 = b_{n-1}$$</div><div>$$aS + x_1 = b_n$$</div><div><br /></div><div>Then it follows that&nbsp;</div><div><br /></div><div>$$x_1 - b_n = x_n - b_1$$</div><div>$$x_2 - b_{n-1} = x_n - b_1$$</div><div>$$\dots$$</div><div>$$x_{n-1} - b_2 = x_n - b_1$$</div><div>$$x_n - b_1 = x_n - b_1$$</div><div><br /></div><div>Let's call these equations <b>the differences equations</b>.&nbsp;</div><div><br /></div><div>When we sum up these equations we get that&nbsp;&nbsp;</div><div><br /></div><div>$S-T = nx_n - nb_1$</div><div><br /></div><div>So it follows that&nbsp;</div><div><br /></div><div>$aS-aT = anx_n - anb_1$</div><div>$(b_1 - x_n)-aT = anx_n - anb_1$</div><div>$b_1(1 + an)-aT = (1 + an)x_n$</div><div><br /></div><div>Note that in this equation only $x_n$ is unknown. Also, we can get analogical equations for all unknowns $x_i$ ($i=1,2,\dots,n)$. They look like this&nbsp; &nbsp;</div><div><br /></div><div>$$(1 + an)b_{n+1-i}-aT = (1 + an)x_i \tag{*}$$</div><div><br /></div><div>We note here that the equations $(*)$ (for $i=1,2,\dots,n$) are just a subsequence of the original system. They are not necessarily equivalent to the original system.&nbsp;</div><div><br /></div><div>Now based on $(*)$ we can look at the possible cases for the parameters $a$ and $b_i$ (where $i=1,2,\dots,n$).&nbsp;</div><div><br /></div><div><b>Case (1)&nbsp;</b></div><div><br /></div><div>$1+an \ne 0$ i.e. $a \ne -1/n$&nbsp;</div><div><br /></div><div>In this case from $(*)$ we find that&nbsp;</div><div><br /></div><div>$$x_1 = b_{n} - \frac{aT}{1+an}$$</div><div>$$x_2 = b_{n-1} - \frac{aT}{1+an}$$</div><div>$$\dots$$</div><div>$$x_n = b_{1} - \frac{aT}{1+an}$$</div><div><br /></div><div>A direct check (substituting the $x_i$ unknowns in the original system with these values) shows that these values are indeed a solution. So in this case the original system has a unique solution given by the formulas above.</div><div><br /></div><div><b>Case (2)&nbsp;</b></div><div>$1+an = 0$ i.e. $a = -1/n$ and $aT \ne 0$</div><div>Note that since $a=-1/n$ the condition $aT \ne 0$ is in fact equivalent to $T \ne 0$.&nbsp;</div><div>So this case is the case when $a=-1/n$ and $T \ne 0$.</div><div><br /></div><div>Obviously the equations $(*)$ cannot be satisfied in this case.&nbsp;&nbsp;</div><div>So in this case the system has no solutions.&nbsp;</div><div><br /></div><div><b>Case (3)&nbsp;</b></div><div>$1+an = 0$ i.e. $a = -1/n$ and $aT = 0$</div><div>Note that since $a=-1/n$ the condition $aT = 0$ is in fact equivalent to $T=0$.&nbsp;&nbsp;</div><div>So this case is the case when $a=-1/n$ and $T = 0$.</div><div><br /></div><div>Now $(*)$ is always satisfied. Going back to <b>the differences equations</b> we see that if we let $x_n=p$ we get&nbsp;</div><div><br /></div><div>$$x_1 = p - b_1 + b_n$$</div><div>$$x_2 = p - b_1 + b_{n-1}$$</div><div>$$\dots$$</div><div>$$x_{n-1} = p - b_1 + b_2$$</div><div>$$x_{n} = p$$</div><div><br /></div><div><div>Again, a direct check (substituting the $x_i$ unknowns in the original system with these values) shows that these values are indeed a solution. So in this case the system has infinite number of solutions which depend on a single parameter $x_n = p$.&nbsp;</div><div><br /></div></div><div>No other cases are possible logically. So this completes the solution of the given system of linear equations.</div><div><br /></div>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-7387855670510130812021-02-15T11:26:00.052+02:002021-02-18T01:15:22.722+02:00An application of the rational root theorem<p>This problem is a nice application of the&nbsp;<a href="https://en.wikipedia.org/wiki/Rational_root_theorem" target="_blank">rational root theorem</a>&nbsp;so I present it here together with a solution which I was able to construct.</p><p><u>Problem:</u>&nbsp;Let $f(x) = a_0x^n + a_1x^{n-1} + a_2x^{n-2} + ... + a_{n-1}x + a_n$ be a polynomial with integer coefficients ($a_i \in \mathbb{Z}$). Here $n \ge 0, n \in \mathbb{Z}$. The number $\alpha = \frac{p}{q}$ is a rational root of $f(x)$, where $p \in \mathbb{Z}$, $q \in \mathbb{Z}$, $q \ne 0$, $(p,q) = 1$. Prove that $(mq-p)\ |\ f(m)$ for every number $m \in \mathbb{Z}$ such that $(mq-p) \ne 0$.</p><p><u>Solution:</u>&nbsp;We will apply induction on the degree $n$ of $f(x)$.</p><p>1) Let $n=0$ i.e. $f(x) = a_0$ is a constant polynomial. Since the number $\alpha$ is a root, it follows that $a_0=0$ i.e. $f(x)$ is the constant $0$. But then $f(m)=0$ for every $m \in \mathbb{Z}$. So for each integer $m$ such that $(mq-p) \ne 0$ we trivially obtain that $(mq-p)\ |\ f(m)$. Thus we proved the statement in the case when $n=0$.</p><p>2) Let's also prove the statement when $n=1$. In this case $f(x) = a_0x + a_1$ and $a_0 \ne 0$. From the rational root theorem we get that $q\ |\ a_0$. Then $a_0 = q c_0$ where $c_0 \in \mathbb{Z}$. So $f(x) = c_0 q x + a_1$. Since $\frac{p}{q}$ is a root of $f(x)$ we get $c_0 q (p/q) + a_1 = 0$ which gives us that $c_0 p + a_1 = 0$. Now for $f(x)$ we get the following $f(x) = c_0qx + a_1 = c_0 (qx-p) + (c_0p + a_1)$. But as we saw $(c_0p + a_1) = 0$. So finally $f(x) = c_0 (qx-p) = c_0 (xq - p)$. From this expression we see that $f(m) = c_0 (mq-p)$ for every integer $m$. Then if $m$ is an integer such that $(mq-p) \ne 0$ we obviously get that $(mq-p)\ |\ f(m)$ which is what we wanted to prove.</p><p>3) Induction hypothesis. We now assume the statement is true for all polynomials $g(x)$ which satisfy the conditions of the problem statement, and have degrees $\le (n-1)$. Again, the statement is as follows: $(mq-p)\ |\ g(m)$ for every number $m \in \mathbb{Z}$ such that $(mq-p) \ne 0$</p><p>4) Now let $f(x) = a_0x^n + a_1x^{n-1} + a_2x^{n-2} + ... + a_{n-1}x + a_n$ be a polynomial of degree $n$ (where $n \ge 2$) which satisfies all conditions of the problem statement. Again from the rational root theorem we obtain that $q\ |\ a_0$ so we can write $a_0 = q c_0$, where $c_0 \in \mathbb{Z}$. Then&nbsp;</p><p>$f(x) = a_0x^n + a_1x^{n-1} + a_2x^{n-2} + ... + a_{n-1}x + a_n =$&nbsp;</p><p>$= q c_0 x^n + a_1x^{n-1} + a_2x^{n-2} + ... + a_{n-1}x + a_n =$</p><p>$= c_0(xq - p) x^{n-1} + (a_1 + c_0p)x^{n-1} + a_2x^{n-2} + ... + a_{n-1}x + a_n$&nbsp;</p><p>So if we denote $h(x) = (a_1 + c_0p)x^{n-1} + a_2x^{n-2} + ... + a_{n-1}x + a_n$ we obtain that&nbsp;</p><p>$f(x) = c_0(xq - p) x^{n-1} + h(x) \tag{*}$&nbsp;</p><p>Now we know $p/q$ is a root of $f(x)$. But obviously it's also a root of $c_0(xq - p) x^{n-1}$. So from equality $(*)$ it follows that $p/q$ is also a root of $h(x)$. This means that now $h(x)$ satisfies all the conditions of the problem statement (it has integer coefficients, $p/q$ is its root etc.). Also $h(x)$ has a degree which does not exceed $n-1$. So we can apply to it the induction hypothesis and when we do so, we get that $(mq-p)\ |\ h(m)$ for every integer $m$ such that $(mq - p) \ne 0$. Obviously it's also true that $(mq-p)\ |\ c_0(mq - p) m^{n-1}$ for every integer $m$ such that $(mq - p) \ne 0$. From the last two statements we obtain that $(mq-p)\ |\ (c_0(mq - p) m^{n-1} + h(m))$ for every integer $m$ such that $(mq - p) \ne 0$. But from $(*)$ this expression $(c_0(mq - p) m^{n-1} + h(m))$ is equal to $f(m)$. Thus we obtain that $(mq-p)\ |\ f(m)$ for every integer $m$ such that $(mq - p) \ne 0$. This completes the induction and therefore the statement is now completely proved.</p><p><u>Note 1:</u>&nbsp;In the special case when $m = 1$ we get that $(p-q)\ |\ f(1)$ (unless $q = p = 1$ of course)</p><p><u>Note 2:</u>&nbsp;In the special case when $m = -1$ we get that $(p+q)\ |\ f(-1)$ (unless $q = -p = \pm1$ of course)</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-29247193858143208602021-01-16T14:16:00.042+02:002021-02-15T11:25:52.844+02:00A problem about scalar matrices $A = \lambda \cdot E$<p>I encountered this problem on&nbsp;<a href="https://math.stackexchange.com/questions/3986927/show-that-the-single-matrix-that-commutes-with-all-invertible-matrices-is-the-sc/3986947" target="_blank">MathSE</a>&nbsp;</p><p>Even though this question was heavily downvoted, I think it's quite a nice problem. Here it is.&nbsp;</p><p><b>We are given that $A$ is a square $n \times n$ matrix which commutes with all invertible matrices of the same size $n$.&nbsp;&nbsp;</b></p><p><b>Prove that $A$ is the scalar matrix i.e. $A = \lambda E\$ where $E$ is the identity matrix and $\lambda$ is a scalar/number.&nbsp;</b></p><p>Let's solve this problem for the case $n=3$. Solving for any $n$ is fully analogical to the case $n=3$.</p><p>Let's assume&nbsp;</p><p>$$A = \begin{bmatrix}a_{11}&amp;a_{12}&amp;a_{13}\\a_{21}&amp;a_{22}&amp;a_{23}\\a_{31}&amp;a_{32}&amp;a_{33}\end{bmatrix}$$</p><p>and let's assume it commutes with all invertible matrices of size 3.</p><p>Let's pick the matrix&nbsp;</p><p>$$B = \begin{bmatrix}1&amp;0&amp;0\\0&amp;2&amp;0\\0&amp;0&amp;3\end{bmatrix}$$</p><p>This one is obviously invertible as its determinant is equal to $6 = 3!$</p><p>Now we use the fact that $AB=BA$.</p><p>$$AB = \begin{bmatrix}a_{11}&amp;a_{12}&amp;a_{13}\\a_{21}&amp;a_{22}&amp;a_{23}\\a_{31}&amp;a_{32}&amp;a_{33}\end{bmatrix} \cdot \begin{bmatrix}1&amp;0&amp;0\\0&amp;2&amp;0\\0&amp;0&amp;3\end{bmatrix} = \begin{bmatrix}a_{11}&amp;2a_{12}&amp;3a_{13}\\a_{21}&amp;2a_{22}&amp;3a_{23}\\a_{31}&amp;2a_{32}&amp;3a_{33}\end{bmatrix}$$</p><p><br /></p><p>$$BA = \begin{bmatrix}1&amp;0&amp;0\\0&amp;2&amp;0\\0&amp;0&amp;3\end{bmatrix} \cdot \begin{bmatrix}a_{11}&amp;a_{12}&amp;a_{13}\\a_{21}&amp;a_{22}&amp;a_{23}\\a_{31}&amp;a_{32}&amp;a_{33}\end{bmatrix} = \begin{bmatrix}a_{11}&amp;a_{12}&amp;a_{13}\\2a_{21}&amp;2a_{22}&amp;2a_{23}\\3a_{31}&amp;3a_{32}&amp;3a_{33}\end{bmatrix}$$</p><p>But these two resulting matrices must be equal. Comparing their respective elements, it's easy to see that we get the following. $$a_{ij} = 0,\ \ for\ \ all\ \ i \ne j \tag{1}$$</p><p>OK... So now our matrix $A$ gets the form</p><p>$$A = \begin{bmatrix}a&amp;0&amp;0\\0&amp;b&amp;0\\0&amp;0&amp;c\end{bmatrix} \tag{2}$$</p><div>Now let's pick another matrix $C$ and use the fact that $A$ commutes with $C$. We pick $C$ to be e.g. the <a href="https://en.wikipedia.org/wiki/Vandermonde_matrix" target="_blank">Vandermonde matrix</a>&nbsp;for the numbers 1,2,3 (the important part is to pick the alphas in the Vandermonde matrix to be all distinct numbers).</div><div><br /></div><div>$$C = \begin{bmatrix}1^0&amp;1^1&amp;1^2\\2^0&amp;2^1&amp;2^2\\3^0&amp;3^1&amp;3^2\end{bmatrix}$$</div><div><br /></div><div>We know that the determinant of $C$ equals $(2-1)(3-1)(3-2) = 2 \ne 0$ so $C$ is invertible.</div><div><br /></div><div>Now in a similar way we use that $A$ commutes with $C$ i.e. $AC = CA$.</div><div><br /></div><div>$$AC = \begin{bmatrix}a&amp;0&amp;0\\0&amp;b&amp;0\\0&amp;0&amp;c\end{bmatrix} \cdot \begin{bmatrix}1^0&amp;1^1&amp;1^2\\2^0&amp;2^1&amp;2^2\\3^0&amp;3^1&amp;3^2\end{bmatrix} = \begin{bmatrix}a&amp;a&amp;a\\b&amp;2b&amp;4b\\c&amp;3c&amp;9c\end{bmatrix}$$&nbsp;</div><div><br /></div><div><div>$$CA =&nbsp; \begin{bmatrix}1^0&amp;1^1&amp;1^2\\2^0&amp;2^1&amp;2^2\\3^0&amp;3^1&amp;3^2\end{bmatrix} \cdot \begin{bmatrix}a&amp;0&amp;0\\0&amp;b&amp;0\\0&amp;0&amp;c\end{bmatrix} = \begin{bmatrix}a&amp;b&amp;c\\a&amp;2b&amp;4c\\a&amp;3b&amp;9c\end{bmatrix}$$&nbsp;</div><div><br /></div></div><div>But these two resulting matrices must be equal. Comparing their first columns we finally get that $a=b=c$.</div><div><br /></div><div>Thus our matrix $A$ finally gets the form</div><div><br /></div><div>$$A = \begin{bmatrix}a&amp;0&amp;0\\0&amp;a&amp;0\\0&amp;0&amp;a\end{bmatrix} \tag{3}$$</div><div><br /></div><div>which is exactly what we wanted to prove.</div><div><br /></div><div><br /></div>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-23511795161684313172020-11-09T14:22:00.031+02:002021-02-18T12:11:12.330+02:00Computing the determinant of a Vandermonde-like matrix<p>This is a problem from a students competition but it looks quite straightforward to solve.</p><p>The task is to compute the determinant of the following matrix.</p><p>$$A = \begin{bmatrix}1&amp;2&amp;3&amp;...&amp;n\\1^2&amp;2^2&amp;3^2&amp;...&amp;n^2\\...&amp;...&amp;...&amp;...&amp;...\\1^n&amp;2^n&amp;3^n&amp;...&amp;n^n\end{bmatrix}$$</p><p>What I noticed is that it looks similar to&nbsp;<a href="Vandermonde's matrix" target="_blank">Vandermonde's matrix</a>&nbsp;even though it's not quite that.&nbsp;</p><p>Let's pull out from its determinant a common multiple $k$ from the $k$-th column for each $k=1,2,3,...,n$.</p><p>We get&nbsp;</p><p>$$det(A) = n! \cdot \begin{vmatrix}1^0&amp;2^0&amp;3^0&amp;...&amp;n^0\\1^1&amp;2^1&amp;3^1&amp;...&amp;n^1\\...&amp;...&amp;...&amp;...&amp;...\\1^{n-1}&amp;2^{n-1}&amp;3^{n-1}&amp;...&amp;n^{n-1}\end{vmatrix}$$</p><p>The matrix whose determinant we got in the RHS of the last equality is the transpose of the Vandermonde matrix (with $\alpha_s = s$, for $s = 1,2,...,n$). Hence its determinant equals the determinant of the Vandermonde matrix itself (since we know that $det(A) = det(A^T)$).</p><p>So (leaving aside the $n!$ multiplier) the determinant we are left with now is Vandermonde's determinant for the numbers $1,2,3,...,n$. We know its value is equal to&nbsp;</p><p>$$\prod\limits_{1 \le i \lt j \le n} (j-i)$$</p><p>So the result we get now is&nbsp;</p><p>$$det(A) = n! \cdot \prod\limits_{1 \le i \lt j \le n} (j-i)$$</p><p>This is the same as&nbsp;</p><p>$$n! \cdot (n-1)^1 \cdot (n-2)^2 \cdot (n-3)^3\ ...\ 3^{n-3} \cdot 2^{n-2} \cdot 1^{n-1}$$</p><p>Finally it is not difficult to realize that this expression is equal to&nbsp;</p><p>$$n!\ \cdot (n-1)!\ \cdot (n-2)!\ ... \ 3! \cdot\ 2! \cdot\ 1!$$</p><p>So this is our final answer here for the determinant of $A$.</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-79097245472822547342020-10-26T18:17:00.029+02:002021-02-18T12:12:58.479+02:00Solving systems of linear equations with SymPy<p>SymPy is a great Python library for symbolic computation. It can be used e.g. for solving systems of linear equations. So if you are manually&nbsp;solving problems from a linear algebra book, and you want to verify your solutions, you can check them against the solutions that SymPy provides. You just need to know how to code the linear system for SymPy.</p><p>Here is an example which illustrates this very well.</p><p><span style="font-family: Consolas;"></span></p><blockquote><p><span style="font-family: Consolas;"><b>import sympy as sp</b></span></p><p><span style="font-family: Consolas;"><b>x, y, z, t = sp.symbols(['x', 'y', 'z', 't'])</b></span></p><p><span style="font-family: Consolas;"><b>solution = solve(</b></span></p><p><span style="font-family: Consolas;"><b>&nbsp; &nbsp; &nbsp; [</b></span></p><p><span style="font-family: Consolas;"><b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2 * x + 3 * y -&nbsp; 5*z + 1 * t&nbsp; -&nbsp; 2&nbsp; ,&nbsp;</b></span></p><p><span style="font-family: Consolas;"><b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2 * x + 3 * y -&nbsp; 1*z + 3 * t&nbsp; -&nbsp; 8&nbsp; ,&nbsp;</b></span></p><p><span style="font-family: Consolas;"><b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6 * x + 9 * y -&nbsp; 7*z + 7 * t&nbsp; - 18&nbsp; ,&nbsp;</b></span></p><p><span style="font-family: Consolas;"><b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4 * x + 6 * y - 12*z + 1 * t&nbsp; -&nbsp; 1&nbsp; &nbsp;</b></span></p><p><span style="font-family: Consolas;"><b>&nbsp; &nbsp; &nbsp; ]</b></span></p><p><span style="font-family: Consolas;"><b>&nbsp; &nbsp; &nbsp; ,&nbsp;</b></span></p><p><span style="font-family: Consolas;"><b>&nbsp; &nbsp; &nbsp; [x,y,z,t]</b></span></p><p><span style="font-family: Consolas;"><b>)</b></span></p><p><span style="font-family: Consolas;"><b>print(solution)</b></span></p><p></p></blockquote><p><br /></p><p>The code above solves the following system.</p><p>$$\begin{bmatrix}2 &amp; 3 &amp; -5 &amp; 1 \\2 &amp; 3 &amp; -1 &amp; 3 \\6 &amp; 9 &amp; -7 &amp; 7 \\4 &amp; 6 &amp; -12 &amp; 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \\ t \end{bmatrix} = \begin{bmatrix} 2 \\ 8 \\ 18 \\ 1 \end{bmatrix}$$</p><p>The solution which SymPy provides is this one&nbsp;</p><p><span style="font-family: Consolas;"><b>{z: 3/2 - t/2, x: -7*t/4 - 3*y/2 + 19/4}</b></span></p><p>The form of this solution implies that $y$ and $t$ are <b>free variables</b>, and can thus be given any values (i.e. they can be taken as free parameters e.g. $y=a, t=b$). The system is then solved (in terms of $a,b$) for the <b>leading variables</b> which happen to be $x$ and $z$.</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-83084603323217352952020-10-20T23:05:00.015+03:002020-10-20T23:57:38.064+03:00Solving the integrals $\int \frac{ \alpha\sin{x} + \beta\cos{x} }{a\sin{x} + b\cos{x}} dx$<p>I found this as a problem in a book, I solved it, and I kind of liked it.&nbsp;</p><p>So I am going to share the end result here.</p><p>The solution to the integral&nbsp;</p><p>$$\int \frac{ \alpha\sin{x} + \beta\cos{x} }{a\sin{x} + b\cos{x}} dx$$&nbsp;</p><p>is the antiderivative function&nbsp;</p><p>$$F(x) = Ax + B \ln{\left|a\sin{x} + b\cos{x}\right|}$$&nbsp;&nbsp;</p><p>where&nbsp;</p><p>$$A = \frac{\alpha a + \beta b}{a^2+b^2}$$</p><p>$$B = \frac{\beta a - \alpha b}{a^2+b^2}$$</p><p>One can verify this by differentiating $F(x)$.</p><p>The original problem, the one which I encountered was actually asking to find the constants $A$ and $B$.</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-2650393219324651212020-10-17T13:12:00.016+03:002020-10-17T13:25:34.798+03:00Indefinite integrals from a differential binomial<p>The expression&nbsp;</p><p>$$x^{m}(ax^n + b)^p \tag{1}$$</p><p>where $m,n,p \in \mathbb{Q}$ and $a,b$ are real non-zero constants is called a <b><a href="https://encyclopediaofmath.org/wiki/Differential_binomial" target="_blank">differential binomial</a></b>.&nbsp;</p><p>The integrals from a differential binomial have the form</p><p>$$\int x^{m}(ax^n + b)^p dx \tag{2}$$</p><p>They can be solved in elementary functions in three cases (detailed below). In all other cases these integrals cannot be solved in elementary functions. Here are the 3 cases in which the integral $(2)$ is solvable.&nbsp;</p><p>1) $p \in \mathbb{Z}$</p><p>In this case we take $k = LCM(m,n)$ and we apply the substitution $x=t^k$, this leads us to an integral from a rational function of $t$.</p><p>2) $\frac{m+1}{n} \in \mathbb{Z}$</p><p>In this case to solve the integral we apply the substitution: $ax^n + b = t$. In this case another (rather obvious) second substitution may be needed $t = g(u)$ to arrive at a rational function of $u$.</p><p>3) $\frac{m+1}{n} + p \in \mathbb{Z}$</p><p>In this case to solve the integral we apply&nbsp;the substitution: $a + bx^{-n} = t$. In this case another&nbsp;(rather obvious) second substitution may be needed $t = g(u)$ to arrive at a rational function of $u$.</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-12832914761777794392020-10-08T23:53:00.020+03:002020-10-17T13:46:51.115+03:00IPython commands<p><b><span style="font-family: Consolas;">IPython basic commands</span></b></p><p><span style="font-family: Consolas;">1) <b>?</b> after module / object / method name - show help info</span></p><p><span style="font-family: Consolas;">2)&nbsp;<b>??</b>&nbsp;after module / object / method name - show detailed help info (usually the source code)</span></p><p><span style="font-family: Consolas;">3) <b>&lt;TAB&gt;&nbsp;</b>after object or while typing object/method -&nbsp;</span><span style="font-family: Consolas;">auto-completion</span></p><p><span style="font-family: Consolas;"><span>4)&nbsp;</span><b>&lt;TAB&gt;&nbsp;</b><span>when importing -&nbsp;</span><span>auto-completion&nbsp;</span></span></p><p><span style="font-family: Consolas;">Examples:&nbsp;</span></p><p><span style="font-family: Consolas;"><b>from &lt;module&gt; import &lt;TAB&gt;</b></span></p><p><span style="font-family: Consolas;"><b>from itertools import co&lt;TAB&gt;</b></span></p><p><span style="font-family: Consolas;"><b><br /></b></span></p><p><b><span style="font-family: Consolas;">IPython&nbsp;</span></b><span style="font-family: Consolas;"><b>keyboard shortcuts&nbsp;</b></span></p><p><span style="font-family: Consolas;">1) Navigation shortcuts:&nbsp;</span></p><p><span style="font-family: Consolas;">Ctrl-a - Move cursor to the beginning of the line</span></p><p><span style="font-family: Consolas;">Ctrl-e - Move cursor to the end of the line</span></p><p><span style="font-family: Consolas;">Ctrl-b (or the left arrow key) - Move cursor back one character</span></p><p><span style="font-family: Consolas;">Ctrl-f (or the right arrow key) - Move cursor forward one character</span></p><p><span style="font-family: Consolas;"><br /></span></p><p><span style="font-family: Consolas;">2) Text manipulation shortcuts:&nbsp;</span></p><p><span style="font-family: Consolas;">Backspace key - Delete previous character in line</span></p><p><span style="font-family: Consolas;">Ctrl-d - Delete next character in line</span></p><p><span style="font-family: Consolas;">Ctrl-k - Cut text from cursor to end of line</span></p><p><span style="font-family: Consolas;">Ctrl-u - Cut text from beginning of line to cursor</span></p><p><span style="font-family: Consolas;">Ctrl-y - Yank (i.e., paste) text that was previously cut</span></p><p><span style="font-family: Consolas;">Ctrl-t - Transpose (i.e., switch) previous two characters</span></p><p><span style="font-family: Consolas;"><br /></span></p><p><span style="font-family: Consolas;">3) Command history shortcuts:&nbsp;</span></p><p><span style="font-family: Consolas;">Ctrl-p (or the up arrow key) - Access previous command in history</span></p><p><span style="font-family: Consolas;">Ctrl-n (or the down arrow key)&nbsp;-&nbsp;Access next command in history</span></p><p><span style="font-family: Consolas;"></span></p><p><span style="font-family: Consolas;">Ctrl-r&nbsp;-&nbsp;Reverse-search through command history</span></p><p><span style="font-family: Consolas;"><br /></span></p><p><span style="font-family: Consolas;">4) Miscellaneous Shortcuts:</span></p><p><span style="font-family: Consolas;">Ctrl-l - Clear terminal screen</span></p><p><span style="font-family: Consolas;">Ctrl-c - Interrupt current Python command</span></p><p><span style="font-family: Consolas;">Ctrl-d - Exit IPython session</span></p><p><b><span style="font-family: Consolas;"><br /></span></b></p><p><span style="font-family: Consolas;"><b>IPython magic commands </b>- more info can be found&nbsp;<a href="https://ipython.readthedocs.io/en/stable/interactive/magics.html" target="_blank"><b>here</b></a></span></p><p><span style="font-family: Consolas;"><b>IPython general information </b>- see&nbsp;<a href="https://ipython.org" style="font-weight: bold;">here</a></span></p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-57621605024486146542020-10-07T11:09:00.020+03:002020-10-17T13:26:23.453+03:00An interesting identity involving radicals<p>This identity came out while solving the indefinite integral</p><p>$$I = \int \frac{dx}{(x+1)\sqrt{x^2+x+1}} \tag{1}$$</p><p>I got my answer as&nbsp;</p><p>$$I = F(x) = \ln { \frac{-1 + \sqrt{x^2+x+1}}{-1-2x+\sqrt{x^2+x+1}}} \tag{2}$$</p><p>but the answer given in the book was&nbsp;</p><p>$$I = G(x) = \ln {\frac{x + \sqrt{x^2+x+1}}{x + 2 + \sqrt{x^2+x+1}}} \tag{3}$$</p><p>Checking the two answers with&nbsp;<a href="https://www.wolframalpha.com/" target="_blank"><b>WA</b></a>&nbsp;shows that both are correct.</p><p>So it is natural then to ask... what is the relation between these two expressions?</p><p>After some short struggle, I found that the relation is as follows:</p><p>$$&nbsp;\frac{-1 + \sqrt{x^2+x+1}}{-1-2x+\sqrt{x^2+x+1}}= (-1) \cdot \frac{x + \sqrt{x^2+x+1}}{x + 2 + \sqrt{x^2+x+1}} \tag{4}$$</p><p>One can easily prove this by letting $a = \sqrt{x^2+x+1}$ and then doing some simple algebraic manipulations.</p><p>Of course $(4)$ is true only for those real values of $x$ for which both sides are well-defined.&nbsp;</p><p>The curious thing is that even though $F(x)$ and $G(x)$ have identical derivatives (<b>identical </b>when viewed&nbsp;as an expression of $x$, I mean), they are never simultaneously well-defined. Why? Because when $$f(x) = \frac{-1 + \sqrt{x^2+x+1}}{-1-2x+\sqrt{x^2+x+1}}$$ and $$g(x) = \frac{x + \sqrt{x^2+x+1}}{x+2+\sqrt{x^2+x+1}}$$ are both defined and non-zero, they have opposite signs (as $(4)$ shows). So we can take logarithm either from one or the other but not from both at the same time.</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-30554388156049379252020-10-07T10:56:00.008+03:002020-10-07T11:06:36.043+03:00Euler substitutions<p>Euler substitutions are used for solving integrals of the form</p><p>$$\int R(x, \sqrt{ax^2+bx+c}) dx \tag{1}$$ where $R$ is a rational two-argument function.</p><p>There is plenty of information about them on the web so this post will be just very short.</p><p>1) The first Euler substitution is defined by</p><p>$\sqrt{ax^2+bx+c} = \sqrt{a} \cdot x + t \tag{2}$</p><p>It is used when $a \gt 0$</p><p>2) The second Euler substitution is defined by</p><p>$\sqrt{ax^2+bx+c} = x \cdot t + \sqrt{c} \tag{3}$</p><p>It is used when $c \gt 0$</p><p>3) The third Euler substitution is used when the quadratic polynomial&nbsp;</p><p>$ax^2+bx+c$ has 2 distinct real roots $\alpha$ and $\beta$.</p><p>It is defined by the equality</p><p>$\sqrt{a(x-\alpha)(x-\beta)} = t \cdot (x-\alpha) \tag{4}$</p><p>The equality $(2), (3),$ or $(4)$ is then solved for $x$, and $x$ is replaced in $(1)$ with the respective resulting expression/function of $t$. This allows us to transform the integral $(1)$ into an integral from a rational function of $t$.</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-76740479035160195272020-09-25T13:35:00.041+03:002020-09-25T14:42:33.963+03:00Several indefinite integrals by non-trivial substitutions<p>This post comes to show several indefinite integrals which can be solved by non-trivial substitutions.</p><p>$$\int \frac{dx}{(a^2+x^2)^2} = \frac{1}{4a^3} \cdot \left(2 \cdot \arctan \frac{x}{a} + \sin \left(2 \cdot \arctan \frac{x}{a}\right)\right), \ \ \ where \ a \gt 0&nbsp;&nbsp;\tag{1}$$&nbsp;</p><p>$$\int \frac{x^3 dx}{(a^2+x^2)^3} = \frac{1}{4a^2} \cdot \sin^4\left(\arctan \frac{x}{a}\right), \ \ \ where \ a \gt 0&nbsp;&nbsp;\tag{2}$$&nbsp;</p><p>The above two integrals (1) and (2) can be solved by using the substitution $x = a \cdot \tan t$.&nbsp;</p><p>This solution uses the fact that the&nbsp;tangent function is a well-known monotonic bijection from $(-\frac{\pi}{2}, \frac{\pi}{2})$ to&nbsp;$\mathbb{R}$.</p><p>Below are two more integrals which are solved by a different substitution.</p><p>$$\int \sqrt{a^2+x^2} dx = \frac{a^2}{2} \cdot \left(\ln\left(\frac{x}{a} + \sqrt{\frac{x^2}{a^2} + 1}\right) + \frac{x}{a} \cdot \sqrt{\frac{x^2}{a^2} + 1}\right), \ \ \ where \ a \gt 0&nbsp;&nbsp;\tag{3}$$&nbsp;</p><div><p>$$\int \frac{dx} {(a^2+x^2)^\frac{3}{2}} = \frac{1}{a^2} \cdot \frac{x^2 + x \cdot \sqrt{x^2+a^2}}{x^2&nbsp; + a^2 + x \cdot \sqrt{x^2+a^2}}, \ \ \ where \ a \gt 0&nbsp;&nbsp;\tag{4}$$&nbsp;&nbsp;</p><div>The integrals (3) and (4) can be solved by the substitution $x = a \cdot \sinh{t}$.&nbsp;</div><div>This solution uses the fact that the&nbsp;hyperbolic sine function is a well-known monotonic bijection from&nbsp;$\mathbb{R}$ to&nbsp;$\mathbb{R}$.</div></div><div><br /></div><div><br /></div><div><br /></div>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-53959584655949937092020-09-16T14:53:00.051+03:002020-09-16T17:03:43.762+03:00Solving the integrals $\int \sin^mx \cdot \cos^nx \cdot dx$<p>In this post we look at solving the integrals of the form&nbsp;</p><p><br /></p><p>$$I(m,n) = \int \sin^mx \cdot \cos^nx \cdot dx \tag{1}$$</p><p>where $m,\ n$ are whole numbers (not necessarily positive).</p><p>This is usually done by applying some of the recurrence formulas listed below.</p><p>$$I(m,n) = \frac{1}{m+1} \sin^{m+1}x \cos^{n-1}x + \frac{n-1}{m+1} \cdot I(m+2, n-2), for\ \ m \ne -1 \tag{2}$$</p><p>$$I(m,n) = -\frac{1}{n+1} \sin^{m-1}x \cos^{n+1}x + \frac{m-1}{n+1} \cdot I(m-2, n+2), for\ \ n \ne -1 \tag{3}$$</p><p>$$I(m,n) = I(m-2,n) - I(m-2,n+2), for\ any \ m,n \tag{4}$$</p><p>$$I(m,n) = I(m,n-2) - I(m+2,n-2), for\ any \ m,n \tag{5}$$</p><p>Then from (2) and (5) we derive (2'), while from (3) and (4) we derive (3'). The formulas (2') and (3') are used to reduce the degree either of the sine or of the cosine. They turn out to be very useful when $m,n$ are positive.</p><p>$$I(m,n) = \frac{1}{m+n} \sin^{m+1}x\cos^{n-1}x + \frac{n-1}{m+n} \cdot I(m, n-2),\ for \ m \ne -1,\ m+n \ne 0 \tag{2'}$$</p><p>$$I(m,n) = -\frac{1}{m+n} \sin^{m-1}x\cos^{n+1}x + \frac{m-1}{m+n} \cdot I(m-2, n),\ for \ n \ne -1,\ m+n \ne 0 \tag{3'}$$</p><p>When both $m, n$ are non-negative usually it is useful to apply formula (6). Note though that (6) is valid for any values of $m,n$, and not just for non-negative values.&nbsp;</p><p>$$I(m,n) = I(m+2, n) + I(m, n+2) \tag{6}$$&nbsp;</p><p>The last two formulas (2'') and (3'') can be easily derived from (2') and (3'). They allow us to increase the degree of the sine or of the cosine. They are usually used when $m$ or $n$ is negative.&nbsp;</p><p>$$I(m,n) =&nbsp; -\frac{1}{n+1} \sin^{m+1}x\cos^{n+1}x +&nbsp; \frac{m+n+2}{n+1} \cdot I(m, n+2),\ for \ m \ne -1,\ n \ne -1 \tag{2''}$$</p><p>$$I(m,n) =&nbsp; \frac{1}{m+1} \sin^{m+1}x\cos^{n+1}x +&nbsp; \frac{m+n+2}{m+1} \cdot I(m+2, n),\ for \ m \ne -1,\ n \ne -1 \tag{3''}$$</p><p>It can be proved that using these formulas the calculation of the integral (1) always boils down to calculating one of the below given integrals. These integrals below are calculated directly (e.g. by integration by parts or by even simpler means).&nbsp;</p><p>$$\int \sin{x}\ dx = -\cos{x}$$</p><p>$$\int \cos{x}\ dx = \sin{x}$$</p><p>$$\int \frac{dx}{\sin{x}} = \ln |\tan ({\frac{x}{2})}|$$</p><p>$$\int \frac{dx}{\cos{x}} = \ln |\tan {(\frac{x}{2}+\frac{\pi}{4})}|$$</p><p>$$\int \sin{x}\ \cos{x}\ dx = -\frac{1}{4}\cos{2x}$$</p><p>$$\int \frac{dx}{\sin{x}\cos{x}} = \ln |\tan {(x)}|$$</p><p>$$\int \frac{\sin{x}}{\cos{x}}\ dx = - \ln |\cos{x}|$$</p><p>$$\int \frac{\cos{x}}{\sin{x}}\ dx = \ln |\sin{x}|$$</p><p>$$\int \sin^2{x}\ dx = \frac{1}{2}x - \frac{1}{4}\sin{2x}$$</p><p>$$\int \cos^2{x}\ dx = \frac{1}{2}x + \frac{1}{4}\sin{2x}$$</p><p>$$\int \frac{dx}{\sin^2{x}} = -\cot{x}$$</p><p>$$\int \frac{dx}{\cos^2{x}} = \tan{x}$$</p><p>It should be noted that when $m$ is odd we can introduce/enter one of the $\sin{x}$ multipliers under the differential sign (where it becomes $\cos{x}$). Then by letting $t=\cos{x}$ and by using that $\sin^2{x} = 1 - \cos^2{x}$, we get an integral from a rational function of $t$.</p><p>Analogically, when $n$ is odd we can introduce/enter one of the $\cos{x}$ multipliers under the differential sign (where it becomes $\sin{x}$). Then by letting $t=\sin{x}$ and by using that $\cos^2{x} = 1 - \sin^2{x}$, we get an integral from a rational function of $t$.</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-30448337597745099582020-09-12T12:05:00.011+03:002020-09-12T12:15:17.056+03:00Sequence defined through an arithmetic mean recurrence<p>There is this nice problem about sequences which I've encountered several times while solving problems in real analysis.</p><p>Two constant real numbers $a,b$ are given and then we have this sequence defined as:&nbsp;&nbsp;</p><p>$$a_0 = a$$</p><p>$$a_1 = b$$</p><p>$$a_{n+2} = \frac{a_{n+1} + a_n}{2},\ \ \ n \ge 0$$</p><p>Prove that the sequence converges and find the limit $L = \lim_{n \to \infty} a_n$&nbsp;&nbsp;</p><p>I won't post the solution here but... it turns out the limit is this number&nbsp;</p><p>$$L = \frac{1}{3} \cdot a + \frac{2}{3} \cdot b$$</p><p>Here is a nice illustration of this fact generated by a Python program.&nbsp;</p><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-OOg1pbJ86Ww/X1yP5H1fwMI/AAAAAAAACBo/79a9A--pmnk_zqRxIfHgN86HDiIhQiaCACLcBGAsYHQ/s1280/Mathematical_Analysis_Fun.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="960" data-original-width="1280" height="300" src="https://1.bp.blogspot.com/-OOg1pbJ86Ww/X1yP5H1fwMI/AAAAAAAACBo/79a9A--pmnk_zqRxIfHgN86HDiIhQiaCACLcBGAsYHQ/w400-h300/Mathematical_Analysis_Fun.png" width="400" /></a></div><br /><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p><br /></p><p>In this case (depicted on the picture) the limit is $$\frac{1}{3} \cdot 10 + \frac{2}{3} \cdot 100 = \frac{1}{3} (10 + 200) = \frac{210}{3} = 70$$</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-63274847647467624652020-08-30T01:28:00.057+03:002020-09-02T00:57:28.803+03:00Basic indefinite integrals<p><b>(1) Basic indefinite integrals:</b></p><p>$$\int x^a \ dx = \frac{x^{a+1}}{a+1} \ \ \ \ \ (a \ne -1) \tag{1}$$&nbsp;</p><p>$$\int \frac{1}{x}\ dx = \ln{\left|x\right|} \ \ \ \ \ \tag{2}$$&nbsp;</p><p>$$\int \sin{x}\ dx = -\cos{x} \ \ \ \ \ \tag{3}$$</p><p>$$\int \cos{x}\ dx = \sin{x} \ \ \ \ \ \tag{4}$$</p><p>$$\int \frac{1}{\cos^2{x}}\ dx = \tan{x} \tag{5}$$&nbsp;</p><p>$$\int \frac{1}{\sin^2{x}}\ dx = -\cot{x}&nbsp;\tag{6}$$&nbsp;</p><p>$$\int {\rm e}^x \ dx = {\rm e}^x \tag{7}$$</p><p>$$\int \frac{1}{1+x^2}\ dx = \arctan{x} \tag{8}$$</p><p>$$\int \frac{1}{\sqrt{1-x^2}}\ dx = \arcsin{x} \tag{9}$$</p><p>$$\int \frac{1}{\sqrt{x^2 + a}}\ dx = \ln {\left|x + \sqrt {x^2 + a}\right|}&nbsp;&nbsp;\ \ \ \ \ (a \ne 0) \tag{10}$$</p><p>Note that these formulas are valid for those values of $x$ for which the integrand function is defined. E.g. $(1)$, $(3)$, $(4)$ are valid for all $x$, $(2)$ is valid for non-zero values of $x$, $(5)$ is valid for values of $x$ such that $\cos{x} \ne 0$.</p><p><b>(2) Additional indefinite integrals:</b></p><p>These three integrals are quite important and often met. The formulas below can be derived via integration by parts.</p><p>$$\int \sqrt{a^2-x^2}\ dx = \frac{1}{2} ( x \sqrt {a^2-x^2} + a^2 \arcsin {\frac{x}{a}} ) \ \ \ \ \&nbsp;\ (a \gt 0, \left|x\right| \lt a) \tag{1'}$$&nbsp;</p><p>$$\int \sqrt{x^2-a^2}\ dx = \frac{1}{2} ( x \sqrt {x^2-a^2} - a^2 \ln {\left|x + \sqrt {x^2-a^2}\right|} ) \ \ \ \ \&nbsp;\ (a \gt 0, \left|x\right| \gt a) \tag{2'}$$&nbsp;</p><p>$$\int \sqrt{x^2+a^2}\ dx = \frac{1}{2} ( x \sqrt {x^2+a^2} + a^2 \ln {\left|x + \sqrt {x^2+a^2}\right|} ) \ \ \ \ \&nbsp;\ (a \gt 0) \tag{3'}$$&nbsp;</p><p><b>(3) Another additional indefinite integral</b></p><p>Let us suppose we are given this integral which we want to calculate. This one is often met when trying to integrate rational functions.</p><p>$$I(a, n) = \int \frac{dx}{(a^2+x^2)^n}$$&nbsp;</p><p>For this integral, one can prove via integration by parts the following recurrent relation:</p><p>$$I(a, n) = \frac{1}{a^2}\cdot\frac{2n-3}{2n-2}\cdot I(a, n-1) + \frac{1}{(2n-2)a^2} \cdot \frac{x}{(a^2+x^2)^{n-1}}$$&nbsp;</p><p>Also, it is easy to see that:&nbsp;</p><p>$$I(a,1) = \frac{1}{a} \cdot \arctan{\frac{x}{a}}$$&nbsp;</p><p>The last two identities give us a procedure for calculating the integrals $I(a, n)$.</p><p><br /></p>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-91395638961041779782020-06-20T13:55:00.044+03:002020-06-29T02:41:09.503+03:00Mean value theorem proof illustratedI was rereading recently the proof of the <b><a href="https://en.wikipedia.org/wiki/Mean_value_theorem" target="_blank">mean value theorem</a></b> from math real analysis.<div><br /></div><div>This led me to the idea to generate some drawing which nicely illustrates the idea of the proof. Let's first restate the <b>mean value theorem</b>.</div><div><br /></div><div><b>Theorem:</b> If the function $f$ is defined and continuous in the closed interval $[a,b]$ and is differentiable in the open interval $(a,b)$, then there exists a point $\theta$ which is strictly between $a$ and $b$ i.e. $a \lt \theta \lt b$, such that&nbsp;</div><div><br /></div><div>$$f'(\theta) = \frac{f(b)-f(a)}{b-a} \tag{1}$$</div><div><br /></div><div>The proof constructs a function and I was wondering what the idea is behind that function. So I finally understood that and wanted to illustrate it here via some nice drawing. It took me some time to find a good looking function but OK... I finally picked this one:&nbsp;</div><div><div><br /></div><div>$$f(x) = \sin(t) - \sin^2(t/2) + \cos^3(t/5) \tag{2}$$</div></div><div><br /></div><div>Here is the drawing I generated.&nbsp;</div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-4zlQ4ZPagQg/XvH0esN5y8I/AAAAAAAABUU/pjGaUlXABVAUinvBC3gXFphnifmTiM2fwCK4BGAsYHg/s1920/Figure_1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1103" data-original-width="1920" src="https://1.bp.blogspot.com/-4zlQ4ZPagQg/XvH0esN5y8I/AAAAAAAABUU/pjGaUlXABVAUinvBC3gXFphnifmTiM2fwCK4BGAsYHg/d/Figure_1.png" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div>The given function $f(x)$ is shown in red in the figure above.</div><div><br /></div><div>The proof of the theorem is quite nice. Main role in it plays the the line which connects the two endpoints of the graph of $f(x)$ i.e. the points $(a,f(a))$ and $(b,f(b))$. This line is represented by the function</div><div><br /></div><div>$$g(x) = f(a) + \frac{f(b)-f(a)}{b-a}(x-a) \tag{3}$$&nbsp;</div><div><br /></div><div>The line is shown in green in the figure above.</div><div><br /></div><div>The proof then goes on to construct the function $h(x) = f(x)-g(x)$ and for this one it can be easily seen that $h(a)=h(b)=0$. The proof then applies <b><a href="https://en.wikipedia.org/wiki/Rolle%27s_theorem" target="_blank">Rolle's theorem</a>&nbsp;</b>to the function $h$ to get the desired result.&nbsp;</div><div><br /></div><div>So I was wondering how this function $h(x)$looks like. It is shown in deep sky blue in the figure above. The interesting thing about this function $h(x)$ is that it measures (at each point $x$) what the difference is between $f(x)$ and $g(x)$.&nbsp;</div><div><br /></div><div>In simple words this can be formulated in 2 different ways:&nbsp;&nbsp;</div><div>a) At any value of $x$ the point $(x,h(x))$ is <b>as far from </b>the X axis, <b>as </b>$(x,f(x))$ <b>is from</b> $(x,g(x))$.&nbsp;</div><div>This follows from the fact that: $h(x) = f(x) - g(x)$ which can be informally stated as <i style="font-weight: bold;"><font color="#00bfff">blue</font> = <font color="#d52c1f">red</font> - <font color="#41b375">green</font></i>.<b>&nbsp;</b></div><div>b) At any value of $x$ the point $(x,f(x))$ is <b>as far from&nbsp;</b>$(x,h(x))$,&nbsp;<b>as</b> $(x,g(x))$ <b>is from </b>the&nbsp;X axis.</div><div>This follows from the fact that: $f(x) - h(x) = g(x)$ which can be informally stated as&nbsp;<i style="font-weight: bold;"><font color="#d52c1f">red&nbsp;</font></i><i style="font-weight: bold;">-&nbsp;</i><i style="font-weight: bold;"><font color="#00bfff">blue</font>&nbsp;=&nbsp;<font color="#41b375">green</font></i>.</div><div><br /></div><div><br /></div><div><br /></div>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-666865608513635462020-05-16T15:23:00.143+03:002020-09-01T02:17:44.206+03:00The function $f(x) = x^x$Let us look at this function&nbsp;<div><br /></div><div>$$f(x) = x^x \tag{1}$$</div><div><br /></div><div>and try to find its derivative for real values of $x$.&nbsp;</div><div><br /></div><div>Before this we should mention that this function is well defined only when $x \gt 0$.&nbsp;</div><div><br /></div><div>In other words... to avoid any complications we are looking at this function only for positive values of $x$.&nbsp;</div><div><br /></div><div><b>I. How do we go about finding the derivative $f'(x) = (x^x)'$ ?&nbsp;</b></div><div><br /></div><div>Well, we will use the following identity&nbsp;</div><div><br /></div><div>$$a^x = e^{x \cdot \ln a} \tag{2}$$</div><div><br /></div><div>which is well-known from high school math and which holds true for any $a \gt 0$ and any $x \in \mathbb{R}$.&nbsp;</div><div><br /></div><div>Substituting $a = x$ in this identity we subsequently get&nbsp;</div><div><br /></div><div>$$f(x) = x^x = e ^ {x \cdot \ln x}$$&nbsp;</div><div><br /></div><div>$$f'(x) = e ^ {x \cdot \ln x} \cdot (x \cdot \ln x)'$$&nbsp;</div><div><br /></div><div>$$f'(x) = e ^ {x \cdot \ln x} \cdot (1 \cdot \ln x + x \cdot \frac{1}{x})$$&nbsp;</div><div><br /></div><div>$$f'(x) = e ^ {x \cdot \ln x} \cdot (\ln x + 1)$$&nbsp;</div><div><br /></div><div>$$f'(x) = x ^ x \cdot (\ln x + 1) \tag{3}$$&nbsp;</div><div><br /></div><div>The last equation $(3)$ gives us the derivative which we wanted to find.&nbsp;</div><div><br /></div><div>In the above derivation we used several simple facts from math analysis.&nbsp;</div><div><br /></div><div>$$(e^x)' = e^x$$</div><div><br /></div><div>$$(f(g(x)))' = f'(g(x)) \cdot g'(x)$$</div><div><br /></div><div>$$(u(x) \cdot v(x))' = u'(x) \cdot v(x) + u(x) \cdot v'(x)$$&nbsp;</div><div><br /></div><div>Finally let us restate the above established formula.&nbsp; &nbsp;</div><div><br /></div><div>$$\large { (x^x)' = x ^ x \cdot (\ln x + 1) } \tag{4}$$&nbsp;</div><div><br /></div><div><b>II. How do we find&nbsp;$\displaystyle{ \lim_{x \to 0^{+}} f(x) } = \displaystyle{ \lim_{x \to 0^{+}} x^x }$ ?</b></div><div><b><br /></b></div><div>I think the easiest way of finding this limit which I have seen is by letting $x=e^{-t}$ where $t$&nbsp;is some very large positive number. Then we easily get the following.&nbsp;</div><div><br /></div><div><div>$$\lim_{x \to 0^{+}} f(x) = \lim_{x \to 0^{+}} x^x = \lim_{x \to 0^{+}} e ^ {x \cdot \ln x} = \lim_{x \to 0^{+}} e ^ {(\ln x) \cdot x} =&nbsp;$$</div></div><div><br /></div><div>$$= \lim_{t \to \infty} e^{(-t) \cdot e^{-t} } = \lim_{t \to \infty} e^{ \frac{(-t)}{e^{t}} } = e ^ {\lim_{t \to \infty} \frac{(-t)}{e^{t} } } = e^0 = 1&nbsp;$$</div><div><br /></div><div>Here the main fact which we used was that&nbsp;&nbsp;</div><div><br /></div><div>$$\lim_{t \to \infty} \frac{(-t)}{e^{t} }&nbsp; = 0$$&nbsp;</div><div><br /></div><div>which is quite obvious given that the numerator is a polynomial of $t$ and the denominator is the exponential function $e^t$.&nbsp;&nbsp;</div><div><br /></div><div><div>This way we have just calculated this quite remarkable limit&nbsp;</div><div><br /></div><div>$$\large \lim_{x \to 0^{+}} x^x = 1 \tag{5}$$&nbsp;</div><div><br /></div></div><div>Finally... here is a video demonstrating nicely an informal numerical approach to finding the same limit&nbsp;<a href="https://youtu.be/r0_mi8ngNnM">What is 0 to the power of 0?</a></div><div><br /></div><div><br /></div><div><br /></div>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-24092719862507272912020-04-27T19:29:00.000+03:002020-04-28T01:32:07.609+03:00Euler's identity for $\frac{sin(x)}{x}$<div dir="ltr" style="text-align: left;" trbidi="on"><br />Here is this famous identity due to Euler.<br /><br />$$\frac{\sin x}{x} = \prod_{k=1}^{\infty} \cos \left(\frac{x}{2^k} \right) \tag{1}$$<br /><br />This holds true for every $x \ne 0$.<br /><br />Let's prove it.<br /><br /><br />Denote:<br /><br />$$S(n) = \prod_{k=1}^{n} \cos \left(\frac{x}{2^k} \right) \tag{2}$$<br /><br />Multiplying the two sides by $sin{\frac{x}{2^n}}$ we sequentially get:<br /><br />$$sin{\frac{x}{2^n}} \cdot S(n) = sin{\frac{x}{2^{n}}} \cdot \prod_{k=1}^{n} \cos \left(\frac{x}{2^k} \right)$$<br />$$sin{\frac{x}{2^n}} \cdot S(n) = sin{\frac{x}{2^{n-1}}} \cdot \frac{1}{2^1} \cdot&nbsp;\prod_{k=1}^{n-1} \cos \left(\frac{x}{2^k} \right)$$<br />$$sin{\frac{x}{2^n}} \cdot&nbsp;S(n) = sin{\frac{x}{2^{n-2}}} \cdot \frac{1}{2^2} \cdot&nbsp;\prod_{k=1}^{n-2} \cos \left(\frac{x}{2^k} \right)$$<br />$$...$$<br />$$sin{\frac{x}{2^n}} \cdot&nbsp;S(n) = sin{\frac{x}{2^{1}}} \cdot \frac{1}{2^{n-1}} \cdot&nbsp;\prod_{k=1}^{1} \cos \left(\frac{x}{2^k} \right)$$<br /><br />The last one obviously gives us:<br /><br />$$sin{\frac{x}{2^n}} \cdot&nbsp;S(n) = \frac{1}{2^{n}} \cdot sin(x) \tag{2}$$<br /><br />which can be easily reworked to:<br /><br />$$\large{ \frac{sin{\frac{x}{2^n}}}{\frac{x}{2^n}} \cdot&nbsp;S(n) = \frac{sin(x)}{x}} \tag{3}$$<br /><br />Now in $(3)$ when we take the limit as ${n\to\infty}$ while using that<br /><br />$$\lim_{u \to 0} \frac{sin(u)}{u} = 1$$<br /><br />we get equality $(1)$ which is what we wanted to prove.<br /><br /><br /></div>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0tag:blogger.com,1999:blog-1243612190666737338.post-74748361156559585032020-04-18T15:00:00.017+03:002020-08-30T13:32:54.929+03:00Trigonometric identities<div dir="ltr" style="text-align: left;" trbidi="on">1) Even/Odd function identities<br /><br />$$\sin(-\alpha) = -\sin\alpha \tag{1.1}$$<br />$$\cos(-\alpha) = \cos\alpha \tag{1.2}$$<br />$$\tan(-\alpha) = -\tan\alpha&nbsp;\tag{1.3}$$<br />$$\cot(-\alpha) = -\cot\alpha&nbsp;\tag{1.4}$$<br /><br />2) Sum/Addition identities<br /><br />$$\sin(\alpha + \beta) = \sin\alpha\cos\beta + \cos\alpha\sin\beta \tag{2.1}$$<br />$$\sin(\alpha - \beta) = \sin\alpha\cos\beta - \cos\alpha\sin\beta \tag{2.2}$$<br />$$\cos(\alpha + \beta) = \cos\alpha\cos\beta - \sin\alpha\sin\beta \tag{2.3}$$<br />$$\cos(\alpha - \beta) = \cos\alpha\cos\beta + \sin\alpha\sin\beta \tag{2.4}$$<br /><br />$$\tan(\alpha + \beta) = \frac{\tan\alpha+\tan\beta}{1-\tan\alpha\tan\beta}\tag{2.5}$$<br /><br />$$\cot(\alpha + \beta) = \frac{\cot\alpha\cot\beta-1}{\cot\alpha+\cot\beta}\tag{2.6}$$<br /><br />3) Sum to product identities<br /><br />$$\sin\alpha + \sin\beta = 2 \sin\frac{\alpha+\beta}{2}\cos\frac{\alpha-\beta}{2} \tag{3.1}$$<br />$$\sin\alpha - \sin\beta = 2 \sin\frac{\alpha-\beta}{2}\cos\frac{\alpha+\beta}{2}&nbsp;\tag{3.2}$$<br /><br />$$\cos\alpha + \cos\beta = 2 \cos\frac{\alpha+\beta}{2}\cos\frac{\alpha-\beta}{2}&nbsp;\tag{3.3}$$<br /><br />$$\cos\alpha - \cos\beta = -2 \sin\frac{\alpha+\beta}{2}\sin\frac{\alpha-\beta}{2}&nbsp;\tag{3.4}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$\tan\alpha \pm \tan\beta = \frac{\sin{(\alpha\pm\beta)}}{\cos\alpha\cos\beta} \tag{3.5}$$</div><div dir="ltr" style="text-align: left;" trbidi="on">$$\cot\alpha \pm&nbsp;\cot\beta = \frac{\sin{(\beta\pm\alpha)}}{\sin\alpha\sin\beta} \tag{3.6}$$<br /><br />4) Product to sum identities<br /><br />$$\sin\alpha\sin\beta = \frac{1}{2}[\cos(\alpha-\beta) - \cos(\alpha+\beta)] \tag{4.1}$$<br /><br />$$\cos\alpha\cos\beta = \frac{1}{2}[\cos(\alpha-\beta) + \cos(\alpha+\beta)] \tag{4.2}$$<br /><br />$$\sin\alpha\cos\beta = \frac{1}{2}[\sin(\alpha+\beta) + \sin(\alpha-\beta)] \tag{4.3}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on"><br />5) Double-angle and triple-angle identities<br /><br />$$\sin 2 \alpha&nbsp; = 2 \sin\alpha \cos\alpha \tag{5.1}$$<br /><br />$$\cos 2 \alpha&nbsp; = \cos^2\alpha - \sin^2\alpha \tag{5.2}$$<br /><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$\tan 2 \alpha&nbsp; = \frac{2\tan\alpha}{1-\tan^2\alpha} = \frac{2}{\cot\alpha - \tan\alpha} \tag{5.3}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$\cot 2 \alpha&nbsp; = \frac{\cot^2\alpha-1}{2\cot\alpha} = \frac{\cot\alpha - \tan\alpha}{2} \tag{5.4}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$\sin 3 \alpha&nbsp; = 3 \sin\alpha - 4\sin^3 \alpha \tag{5.5}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$\cos 3 \alpha&nbsp; = 4\cos^3 \alpha - 3 \cos\alpha \tag{5.6}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$\tan 3 \alpha&nbsp; = \frac{3\tan \alpha - \tan^3 \alpha}{1 - 3 \tan^2 \alpha} \tag{5.7}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$\cot 3 \alpha&nbsp; = \frac{\cot^3 \alpha - 3 \cot \alpha}{3\cot^2 \alpha - 1} \tag{5.8}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">6) Decreasing the power of sine and cosine</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$2 \sin^2 \alpha = 1 - \cos 2\alpha \tag{6.1}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$4 \sin^3 \alpha = 3 \sin \alpha - \sin 3\alpha \tag{6.2}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$8 \sin^4 \alpha = \cos 4\alpha - 4 \cos 2\alpha + 3 \tag{6.3}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$2 \cos^2 \alpha = 1 + \cos 2\alpha \tag{6.4}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$4 \cos^3 \alpha = 3 \cos \alpha + \cos 3\alpha \tag{6.5}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on">$$8 \cos^4 \alpha = \cos 4\alpha + 4 \cos 2\alpha + 3 \tag{6.6}$$</div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div><div dir="ltr" style="text-align: left;" trbidi="on"><br /></div>petrovhttp://www.blogger.com/profile/14750572373308546381noreply@blogger.com0