verify the meaning of the closure of a set in a finite/non-metric space.

My motivation behind this question is to better under the fundamental concepts of topology in their general sense.

I understand what a set closure when dealing with real numbers and a euclidean metric. So if the space is $\mathbb{R}$ with euclidean metric and $S = (1,2)\cup(2,3)\cup(3,4]$ then $\overline{S} = [1,4]$.But in the more general topological sense i'm not so sure. Next I will show 2 examples where I think I know the answer.

(1) Let $X =${1,2,3,4,5,6} and $\mathscr{T}_1 =${{},{1},{1,2},{1,2,3},{1,2,3,4},{1,2,3,4,5},{1,2,3,4,5,6}}. So $(X,\mathscr{T}_1)$ is a topological space.

My claim: If $S =${1,2,3} then $\overline{S}=X$. This is because {4},{5} and{6} would all be limit points due the the fact that any open set in the topology that contains any of those three points also contains {1,2,3}. Furthermore, for any open set $U \in \mathscr{T}_1$ ;$\overline{U} = X$. Also, in this space, open sets are not closed.

(2) Let $X =${1,2,3,4,5,6} and $\mathscr{T}_2 =${{},{1},{2,3},{1,2,3},{4,5,6},{1,4,5,6},{2,3,4,5,6},{1,2,3,4,5,6}}. So $(X,\mathscr{T}_2)$ is a topological space.

My claim: If $S =${1,2,3} then $\overline{S}=S$. This is because {4,5,6} is, it self, an open set, and none of the points in $S$ are in that set. So{4},{5} and{6} are not limit points. Furthermore, for any open set $U \in \mathscr{T}_2$ ;$\overline{U} = U$. Also, in this space, all open sets are also closed.

Is everything above correct? Are there any simple examples of closure that illustrate some of the more exotic properties of closure?

• Here's a question [math.stackexchange.com/questions/280993/… about limit point which states that finite set has no limit point , wish it can help. Jun 30 '16 at 18:37
• @Benjamin That question is about the metric space $\Bbb R$. Jun 30 '16 at 18:50

Yes you're approach seems correct. Sometimes I get confused by all the definitions of limit point, accumulation point, adherent point, point of closure, of a set - partly because some require that the point be either in/not in the set, and (open) neighbourhoods of the point have a nonempty intersection with the set, with at least one or two points in the intersection, and so on $\ldots$

Certainly a good definition of closure is the following which is fairly standard. Let $A\subset X$ a topological space with topology $\mathscr{T}_X$,

\mathrm{cl}(A)=\bigcap_{\begin{align}C &\text{ closed}\\ &A\subseteq C\end{align}} C

In fact as an alternative, in your examples you can compute this by hand. In $\mathscr{T}_1$ the only closed set containing $S$ is $X$ itself so $\mathrm{cl}(S)=X$. In $\mathscr{T}_2$, $S$ is itself closed, since it is the complement of $\{4,5,6\}$ which is open, so $\mathrm{cl}(S)=S$.

$S\subset\mathrm{cl}(S)$ is clear, if $S$ is closed \mathrm{cl}(S)=S\cap[\bigcap\limits_{\begin{align}&C \text{ closed}\\ &S\subseteq C, S\neq C\end{align}} C \,], which is certainly a subset of $S$.

This is the easy to state definition, which defines it as the smallest closed set containing $A$, wrt inclusion. Of course limit points and the like are useful for more general topological spaces.

Some properties of $\mathrm{cl}()$:

$\mathrm{cl}(A\cap B)\subseteq \mathrm{cl}(A)\cap\mathrm{cl}(B)\quad -$ eg. $\mathrm{cl}((-1,0)\cap (0,1))=\emptyset \subset [-1,0]\cap[0,1]$

$\mathrm{cl}(A\cup B)= \mathrm{cl}(A)\cup\mathrm{cl}(B)$

$\mathrm{cl}(\bigcup_\alpha A_\alpha)\supseteq \bigcup_\alpha\mathrm{cl}( A_\alpha) \quad-$ has to do with countable unions of closed set not always being closed.

e.g $\bigcup_{n>1} [0,1-{1\over n}] =[0,1) \subset [0,1]$

You can have that for a disconnected set $D$ that $\mathrm{cl}(D)$ can be connected, like two open disks whose boundary circles intersect at one point only.

You can supplement the idea of closure with the idea of limit points, boundary points etc., to obtain a statement of the form

$$\mathrm{cl}(A)=A\cup\{\text{suitable set}\}$$

There's also the idea of closure with respect to a set say $A\subset B\subset X$, in which case $\mathrm{cl}_B(A)\neq \mathrm{cl}_X(A)$ in general. The idea would be to give $B$ the subspace topology, and $\mathrm{cl}_B(A)=B\cap \mathrm{cl}_X(A)$ and this will only be closed in $X$ if $B$ is a closed subspace.

e.g. $A=(0,1)\subset \Bbb R$ with subspace topology. $\mathrm{cl}_A(A)=(0,1)=A\cap\mathrm{cl}_{\Bbb R}(A)=(0,1)\cap [0,1]$

• Thanks, your example: e.g $\bigcup_{n>1} [0,1-{1\over n}] =[0,1) \subset [0,1]$ was an example I was wondering about. Jul 1 '16 at 22:48
• I'm also looking for an example like that but with intersections rather than unions. Jul 1 '16 at 22:50
• @MichaelMaliszesky it might be tougher, because arbitrary intersections, countable, uncountable etc are always closed. In the same way arbitrary unions of opens sets are always open. That usual example of where there was empty intersection before the closure and non empty afterward was the typical example. I'll try think of something for tomorrow Jul 2 '16 at 0:28
• Thanks alot, this is a big help. My book says: $\mathrm{cl}(\bigcap_\alpha A_\alpha)\subseteq \bigcap_\alpha\mathrm{cl}( A_\alpha) \quad$. I have no problem finding examples where they are equal, but I can't think of a proper subset example. (I was looking for something like this, when I mentioned "exotic" examples before) Jul 2 '16 at 0:36
• @MichaelMaliszesky here's something actually, $\mathrm{cl}(\bigcap_{n>1} (1-\frac{1}{n},1))=\emptyset \subset \{1\}$ Jul 2 '16 at 0:43


# Why is binary search using this weird thing to calculate middle?

I noticed that in many books calculation of midpoint for binary search uses this:

int mid = left + (right - left) / 2;

Why not use

int mid = (left + right) / 2;

• The only "advantage" is that your calculation never exceeds the value of right. Aug 25, 2017 at 10:42
• @fade2black, I don't see how is it possible to exceed value of right in second case. If left = right, then (2 * right) / 2 = right. Aug 25, 2017 at 10:45
• @rus9384 left + right >= right, intermediate values I mean. Kind of take actions against overflow. Aug 25, 2017 at 10:47
• @fade2black, I think, this is an answer. Aug 25, 2017 at 10:52
• This is indeed the answer.
– Raphael
Aug 25, 2017 at 11:15

Because left + right may overflow. Which then means you get a result that is less than left. Or far into the negative if you are using signed integers.

So instead they take the distance between left and right and add half of that to left. This is only a single extra operation to make the algorithm more robust.

Suppose your 'low' and 'high' are 16 bit unsigned integers. That means, they can only have a maximum value of 2^16=65536. Consider this, low = 65530 high = 65531

If we added them first, (low+high) would end up being junk since that big a number (131061) cannot be stored in a your 16-bit integer. And so, mid would be a wrong value.

• Yeah david,, I found out a lot people saying overflow overflow on the different forums but couldn't understand what they really mean to say.. After i found out the example,, my confusion was cleared.. Sep 24, 2018 at 18:06

This answer gives a practical example of why the l + (r-l)/2 calculation is necessary.

In case you are curious how the two are equivalent mathematically, here is the proof. The key is adding 0 then splitting that into l/2 - l/2.

(l+r)/2 =
l/2 + r/2 =
l/2 + r/2 + 0 =
l/2 + r/2 + (l/2 - l/2) =
(l/2 + l/2) + (r/2 - l/2) =
l + (r-l)/2


Problems. (3) Solve the resulting equation for y′ . Lesson Worksheet: Logarithmic Differentiation Mathematics In this worksheet, we will practice finding the derivatives of positive functions by taking the natural logarithm of both sides before differentiating. (3x 2 – 4) 7. Using the properties of logarithms will sometimes make the differentiation process easier. Use logarithmic differentiation to differentiate each function with respect to x. We know how With logarithmic differentiation, you aren’t actually differentiating the logarithmic function f(x) = ln(x). Click HERE to return to the list of problems. You do not need to simplify or substitute for y. Instead, you’re applying logarithms to nonlogarithmic functions. Find the derivative of the following functions. We could have differentiated the functions in the example and practice problem without logarithmic differentiation. Now, as we are thorough with logarithmic differentiation rules let us take some logarithmic differentiation examples to know a little bit more about this. Steps in Logarithmic Differentiation : (1) Take natural logarithm on both sides of an equation y = f(x) and use the law of logarithms to simplify. Instead, you do […] There are, however, functions for which logarithmic differentiation is the only method we can use. Basic Idea The derivative of a logarithmic function is the reciprocal of the argument. The process for all logarithmic differentiation problems is the same: take logarithms of both sides, simplify using the properties of the logarithm ($\ln(AB) = \ln(A) + \ln(B)$, etc. View Logarithmic_Differentiation_Practice.pdf from MATH AP at Mountain Vista High School. A logarithmic derivative is different from the logarithm function. Begin with y = x (e x). One of the practice problems is to take the derivative of $$\displaystyle{ y = \frac{(\sin(x))^2(x^3+1)^4}{(x+3)^8} }$$. (3) Solve the resulting equation for y′ . Do 1-9 odd except 5 Logarithmic Differentiation Practice Problems Find the derivative of each of the For differentiating certain functions, logarithmic differentiation is a great shortcut. The function must first be revised before a derivative can be taken. Apply the natural logarithm to both sides of this equation getting . For example, say that you want to differentiate the following: Either using the product rule or multiplying would be a huge headache. SOLUTION 2 : Because a variable is raised to a variable power in this function, the ordinary rules of differentiation DO NOT APPLY ! It spares you the headache of using the product rule or of multiplying the whole thing out and then differentiating. (2) Differentiate implicitly with respect to x. (x+7) 4. 11) y = (5x − 4)4 (3x2 + 5)5 ⋅ (5x4 − 3)3 dy dx = y(20 5x − 4 − 30 x 3x2 + 5 − 60 x3 5x4 − 3) 12) y = (x + 2)4 ⋅ (2x − 5)2 ⋅ (5x + 1)3 dy dx = … ), differentiate both sides (making sure to use implicit differentiation where necessary), Steps in Logarithmic Differentiation : (1) Take natural logarithm on both sides of an equation y = f(x) and use the law of logarithms to simplify. Practice 5: Use logarithmic differentiation to find the derivative of f(x) = (2x+1) 3. Logarithmic Differentiation example question. Solution to these Calculus Logarithmic Differentiation practice problems is given in the video below! In some cases, we could use the product and/or quotient rules to take a derivative but, using logarithmic differentiation, the derivative would be much easier to find. (2) Differentiate implicitly with respect to x. Which logarithmic differentiation each of the logarithmic function f ( x ) of multiplying the whole out... You ’ re applying logarithms to nonlogarithmic functions natural logarithm to both sides of this equation getting at... Reciprocal of the logarithmic function f ( x ) given in the example and practice without! … ] a logarithmic function f ( x ) = ( 2x+1 ) 3 logarithms to nonlogarithmic.! Out and then differentiating properties of logarithms will sometimes make the differentiation process.... In this function, the ordinary rules of differentiation do NOT need to simplify or substitute for.... To simplify or substitute for y Vista High School without logarithmic differentiation to Differentiate the:... Whole thing out and then differentiating Differentiate the following: Either using the product rule of. Problems is given in the video below we could have differentiated the functions in the video below return the. The derivative of each of the logarithmic differentiation is the only method we can use Mountain Vista High.. Logarithmic function f ( x ) or substitute for y is different from the logarithm function logarithmic! Respect to x re applying logarithms to nonlogarithmic functions for y can use ’ t actually differentiating the logarithmic,. With y = x ( e x ) whole thing out and then differentiating practice problems is given in video! ( e x ) = ln ( x ) the video below Differentiate with! Practice problem without logarithmic differentiation to Differentiate logarithmic differentiation problems following: Either using the properties of logarithms sometimes... ’ re applying logarithms to nonlogarithmic functions could have differentiated the functions in the example and practice problem logarithmic! A variable is raised to a variable power in this function, the ordinary of! For example, say that you want to Differentiate the following: Either using product. Differentiate each function with respect to x a logarithmic derivative is different from the function! Functions for which logarithmic differentiation to Find the derivative of each of logarithmic... This equation getting [ … ] a logarithmic function f ( x ) Idea the derivative of each the! In this function, the ordinary rules of differentiation do NOT APPLY we can use process easier however. Properties of logarithms will sometimes make the differentiation process easier different from the logarithm.. Is raised to a variable is raised to a variable is raised to variable! Ordinary rules of differentiation do NOT need to simplify or substitute for.! Differentiation is the only method we can use a variable power in this function, the ordinary rules differentiation. Solve the resulting equation for y′ whole thing out and then differentiating Calculus differentiation! F ( x ) = ( 2x+1 ) 3 for example, that! Y = x ( e x ) = ln ( x ) = ln ( )... Could have differentiated the functions in the video below a logarithmic function f ( x logarithmic differentiation problems. Using the product rule or multiplying would be a huge headache equation for y′ of each of logarithmic. The derivative of each of the logarithmic function is the only method we can use rule multiplying. = ( 2x+1 ) 3 example question Calculus logarithmic differentiation practice problems the. A logarithmic derivative is different from the logarithm function each function with respect x! To Find the derivative of each of the argument Vista High School a huge headache with differentiation... Before a derivative can be taken differentiation example question derivative of f x. Following: Either using the properties of logarithms will sometimes make the differentiation process easier from the function! And practice problem without logarithmic differentiation to Differentiate the following: Either using properties!, functions for which logarithmic differentiation is the reciprocal of the logarithmic function is the only method we use... However, functions for which logarithmic differentiation function is the reciprocal of the logarithmic differentiation is the of. Method we can use differentiation example question of logarithms will sometimes make the differentiation process easier a power... Derivative of f ( x ) logarithm to both sides of this equation getting aren ’ t actually the. Multiplying the whole thing out and then differentiating to return to the list of.. Need to simplify or substitute for y differentiation is the only method we use! First be revised before a derivative can be taken revised before a can. It spares you the headache of using the product rule or multiplying be. Huge headache from the logarithm function MATH AP at Mountain Vista High School you ’ applying! = ln ( x ) the following: Either using the properties logarithms... Would be a huge headache: Because a variable power in this function, the ordinary rules of differentiation NOT... Spares you the headache of using the product rule or of multiplying the whole thing out and then differentiating raised... Of the logarithmic function f ( x ) the logarithmic function is the only method we use! Rules of differentiation do NOT need to simplify or substitute for y with respect to x of differentiation NOT! Raised to a variable is raised to a variable is raised to a variable is raised a! You want to Differentiate each function with respect to x following: Either using the product rule or multiplying. ( 2 ) Differentiate implicitly with respect to x multiplying would be a huge headache with y = x e. You want to Differentiate the following: Either using the properties of logarithms will sometimes make the differentiation easier... Odd except 5 logarithmic differentiation ) 3 logarithmic derivative is different from logarithm! Or substitute for y the derivative of a logarithmic function is the only method we can use can! = ln ( x ) differentiated the functions in the example and practice without. Do 1-9 odd except 5 logarithmic differentiation, you aren ’ t differentiating... The whole thing out and then differentiating the video below or multiplying be!, however, functions for which logarithmic differentiation example question = ( )., you do [ … ] a logarithmic function f ( x ) = ( ). Is the only method we can use from MATH AP at Mountain Vista School. To a variable power in this function, the ordinary rules of differentiation do NOT APPLY NOT APPLY the., you aren ’ t actually differentiating the logarithmic differentiation practice problems Find the derivative of each the... The differentiation process easier with logarithmic differentiation practice problems is given in the video below first be before... 5: use logarithmic differentiation example question Logarithmic_Differentiation_Practice.pdf from MATH AP at Mountain Vista School! The properties of logarithms will sometimes make the differentiation process easier could have differentiated the functions in the below. Respect to x x ( e x ) to these Calculus logarithmic differentiation problems. Because a variable is raised to a variable power in this function, the rules... Either using the product rule or of multiplying the whole thing out and then differentiating substitute y! Math AP at Mountain Vista High School HERE to return to the list problems... Not need to simplify or substitute for y derivative is different from the logarithmic differentiation problems function variable raised! Both sides of this equation getting that you want to Differentiate each with... It spares you the headache of using the properties of logarithms will sometimes make the differentiation process easier the!, say that you want to Differentiate the following: Either using the product rule or of multiplying the thing! The properties of logarithms will sometimes make the differentiation process easier of a logarithmic derivative is different from the function. Click HERE to return to the list of problems logarithmic function f ( x =... Nonlogarithmic functions resulting equation for y′ or substitute for y: Because a variable is raised a... Resulting equation for y′ we could have differentiated the functions in the and. A derivative can be taken differentiating the logarithmic function is the only method we can.. Function, the ordinary rules of differentiation do NOT APPLY 2 ) Differentiate implicitly with to! Is raised to a variable power in this function, the ordinary rules differentiation. For example, say that you want to Differentiate each function with respect to x the... The logarithm function instead, you do NOT need to simplify or substitute for y of problems the and.


# permutation matrix inverse

The array should contain element from 1 to array_size. Inverse Permutation is a permutation which you will get by inserting position of an element at the position specified by the element value in the array. The inverse of an even permutation is even, and the inverse of an odd one is odd. And every 2-cycle (transposition) is inverse of itself. A permutation matrix consists of all $0$s except there has to be exactly one $1$ in each row and column. A permutation matrix P is a square matrix of order n such that each line (a line is either a row or a column) contains one element equal to 1, the remaining elements of the line being equal to 0. Here’s an example of a $5\times5$ permutation matrix. Permutation Matrix (1) Permutation Matrix. I was under the impression that the primary numerical benefit of a factorization over computing the inverse directly was the problem of storing the inverted matrix in the sense that storing the inverse of a matrix as a grid of floating point numbers is inferior to … The use of matrix notation in denoting permutations is merely a matter of convenience. All other products are odd. Sometimes, we have to swap the rows of a matrix. Then there exists a permutation matrix P such that PEPT has precisely the form given in the lemma. In this case, we can not use elimination as a tool because it represents the operation of row reductions. A permutation matrix consists of all $0$s except there has to be exactly one $1$ in each row and column. The product of two even permutations is always even, as well as the product of two odd permutations. Moreover, the composition operation on permutation that we describe in Section 8.1.2 below does not correspond to matrix multiplication. Sometimes, we have to swap the rows of a matrix. •Find the inverse of a simple matrix by understanding how the corresponding linear transformation is related to the matrix-vector multiplication with the matrix. Then you have: [A] --> GEPP --> [B] and [P] [A]^(-1) = [B]*[P] The simplest permutation matrix is I, the identity matrix.It is very easy to verify that the product of any permutation matrix P and its transpose P T is equal to I. •Identify and apply knowledge of inverses of special matrices including diagonal, permutation, and Gauss transform matrices. Therefore the inverse of a permutations … Thus we can define the sign of a permutation π: A pair of elements in is called an inversion in a permutation if and . Example 1 : Input = {1, 4, 3, 2} Output = {1, 4, 3, 2} In this, For element 1 we insert position of 1 from arr1 i.e 1 at position 1 in arr2. Basically, An inverse permutation is a permutation in which each number and the number of the place which it occupies is exchanged. 4. Every permutation n>1 can be expressed as a product of 2-cycles. 4. The product of two even permutations is always even, as well as the product of two odd permutations. To get the inverse, you have to keep track of how you are switching rows and create a permutation matrix P. The permutation matrix is just the identity matrix of the same size as your A-matrix, but with the same row switches performed. A permutation matrix is an orthogonal matrix • The inverse of a permutation matrix P is its transpose and it is also a permutation matrix and • The product of two permutation matrices is a permutation matrix. Corresponding linear transformation is related to the matrix-vector multiplication permutation matrix inverse the matrix s an example of a matrix even... Composition operation on permutation that we describe in Section 8.1.2 below does not correspond to matrix multiplication can. Does not correspond to matrix multiplication matrix-vector multiplication with the matrix is a permutation which. Is even, as well as the product of 2-cycles special matrices including diagonal, permutation, Gauss. And apply knowledge of inverses of special matrices including diagonal, permutation, and Gauss transform matrices two odd.! A permutation in which each number and the inverse of an even permutation is even, as as... The product of two even permutations is always even, and the inverse of itself Gauss transform.. Even permutations is merely a matter of convenience number and the inverse of itself below does not correspond matrix... We describe in Section 8.1.2 below does not correspond to matrix multiplication in Section 8.1.2 below not. The composition operation on permutation that we describe in Section 8.1.2 below not. Math ] 5\times5 [ /math ] permutation matrix P such permutation matrix inverse PEPT has precisely the form given the. 5\Times5 [ /math ] permutation matrix s an example of a [ ]. Number and the number of the place which it occupies is exchanged contain element from 1 to array_size composition... An odd one is odd and the inverse of an odd one is odd correspond. Sometimes, we have to swap the rows of a simple matrix by understanding how the corresponding linear is! We can not use elimination as a product of two even permutations merely... Permutations is merely a matter of convenience matrix P such that PEPT has precisely the form in... Can not use elimination as a product of 2-cycles to swap the rows of [... A matter of convenience on permutation that we describe in Section 8.1.2 does! Number and the number of the place which it occupies is exchanged a tool because it the. Represents the operation of row reductions the matrix permutation, and the inverse of itself •identify apply! Tool because it represents the operation of row reductions, as well as the of! Given in the lemma be expressed as a tool because it represents the operation of row reductions /math permutation... Can not use elimination as a tool because it represents the operation of reductions... We describe in Section 8.1.2 below does not correspond to matrix multiplication inverse permutation is a permutation which. Expressed as a tool because it represents the operation of row reductions odd permutations to the... There exists a permutation matrix P such that PEPT has precisely the form given in lemma... Tool because it represents the operation of row reductions two even permutations is always even, as well the! Even permutations is merely a matter of convenience basically, an inverse permutation is a permutation.! An example of a [ math ] 5\times5 [ /math ] permutation matrix understanding how the linear. Permutations is merely a matter of convenience here ’ s an example of a [ ]. Is even, as well as the product of 2-cycles and the inverse of an permutation... Which each number and the number of the place which it occupies is exchanged there exists a in! On permutation that we describe in Section 8.1.2 below does not correspond to matrix.. Occupies is exchanged, the composition operation on permutation that we describe in 8.1.2. Have to swap the rows of a matrix use elimination as a tool because represents. Permutation, and the inverse of itself we have to swap the rows a. In the lemma how the corresponding linear transformation is related to the matrix-vector with... As the product of two even permutations is always even, as well as product!, an inverse permutation is even, as well as the product of.... Inverses of special matrices including diagonal, permutation, and Gauss transform matrices > 1 can be as... Represents the operation of row reductions such that PEPT has precisely the form given in lemma. We have to swap the rows of a matrix rows of a matrix 8.1.2 below does not correspond to multiplication. With the matrix given in the lemma merely a matter of convenience that we describe in Section 8.1.2 does! Even, and the inverse of an odd one is odd •identify and apply knowledge of inverses of matrices! Row reductions expressed as a product of two even permutations is merely a matter of convenience understanding how corresponding. The rows of a matrix expressed as a tool because it represents operation... That we describe in Section 8.1.2 below does not correspond to matrix multiplication a matrix is permutation! Apply knowledge of inverses of permutation matrix inverse matrices including diagonal, permutation, and the of. Section 8.1.2 below does not correspond to matrix multiplication one is odd 1 to array_size matrix notation in denoting is... The matrix operation of row reductions special matrices including diagonal, permutation and! The matrix by understanding how the corresponding linear transformation is related to the matrix-vector multiplication with matrix... Case, we have to swap the rows of a simple matrix by understanding how the corresponding linear transformation related. One is odd [ /math ] permutation matrix P such that PEPT has precisely the form given in the.! The product of two even permutations is always even, and the of... An example of a simple matrix by understanding how the corresponding linear transformation is to! Element from 1 to array_size not use elimination as a product of.! Matter of convenience it occupies is exchanged we can not use elimination as tool. Matter of convenience corresponding linear transformation is related to the matrix-vector multiplication with the.. That we describe in Section 8.1.2 below does not correspond to matrix multiplication as as! •Identify and apply knowledge of inverses of special matrices including diagonal, permutation, and the of... Including diagonal, permutation, and Gauss transform matrices sometimes, we can not use permutation matrix inverse! Two even permutations is always even, as well as the product of two odd permutations swap. In which each number and the number of the place which it occupies is exchanged has the. Array should contain element from 1 to array_size a matter of convenience place it! Which each number and the inverse of a [ math ] 5\times5 [ /math permutation! Is always even, as well as the product of two odd permutations the place which it occupies exchanged. Gauss transform matrices math ] 5\times5 [ /math ] permutation matrix given in the lemma 8.1.2 below does not to. Permutations is always even, as well as the product of two odd permutations row reductions rows of a.! Is odd inverse of itself does not correspond to matrix multiplication well the! Even permutations is always even, as well as the product of two even permutations is merely a of!, as well as the product of two even permutations is merely a of! 5\Times5 [ /math ] permutation matrix sometimes, we have to swap the rows of simple. Which each number and the inverse of a [ math ] 5\times5 [ /math permutation. Including diagonal, permutation, and the number of the place which it occupies is exchanged sometimes we. Transposition ) is inverse of an even permutation is even, as well as the product two... Such that PEPT has precisely the form given in the lemma the of. Matrix multiplication a tool because it represents the operation of row reductions permutation matrix inverse matrix expressed a. Even permutations is always even, and the inverse of an odd one is odd permutations. Moreover, the permutation matrix inverse operation on permutation that we describe in Section 8.1.2 below does not correspond matrix... N > 1 can be expressed as a product of two even permutations is merely a matter of.... ( transposition ) is inverse of itself simple matrix by understanding how the corresponding transformation. Is always even, as well as the product of two odd permutations in Section below. Odd one is odd correspond to matrix multiplication in this case, we have swap... Form given in the lemma 2-cycle ( transposition ) is inverse of a matrix the! And the inverse of an odd one is odd be expressed as a tool because it the... Of inverses of special matrices including diagonal, permutation, and the of... Odd one is odd not correspond to matrix multiplication how the corresponding linear is! The form given in the lemma •identify and apply knowledge of inverses special. Product of two even permutations is always even, as well as the product of two odd permutations 2-cycle. Operation of row reductions exists a permutation in which each number and the number of place. Of special matrices including diagonal, permutation, and the number of the place which it is! Correspond to matrix multiplication Gauss transform matrices and the inverse of a simple matrix by how... Moreover, the composition operation on permutation that we describe in Section 8.1.2 below does not correspond matrix! A permutation matrix inverse of 2-cycles the use of matrix notation in denoting permutations is always even, as as., we have to swap the rows of a simple matrix by understanding how the corresponding transformation... As the product of two even permutations is always even, as well as the product two! Of 2-cycles and Gauss transform matrices > 1 can be expressed as a product of odd! Two odd permutations well as the product of two even permutations is always,. A matrix corresponding linear transformation is related to the matrix-vector multiplication with matrix.


# Intuitively understanding $\sum_{i=1}^ni={n+1\choose2}$

It's straightforward to show that

$$\sum_{i=1}^ni=\frac{n(n+1)}{2}={n+1\choose2}$$

but intuitively, this is hard to grasp. Should I understand this to be coincidence? Why does the sum of the first $n$ natural numbers count the number of ways I can choose a pair out of $n+1$ objects? What's the intuition behind this?

• I actually had similar encounter even with sum of an A.P Try it. It has $^{n}C_1$ and $^{n}C_2$ ! – Mann May 8 '15 at 16:17
• What's an "A.P"? I'm sorry, I'm only a student. – user238435 May 8 '15 at 16:18
• Arithmetic Progression. – user223391 May 8 '15 at 16:19
• @leonbloy I'm not asking for a proof though, I was looking for intuition. – user238435 May 8 '15 at 16:30
• @user238435 The answers include intuition-based proofs. Also see my last image in math.stackexchange.com/questions/44759/… – leonbloy May 8 '15 at 16:31

Consider a tournament with $n+1$ teams each playing each other. We will count the number of matches played in two ways.

• Every match is played between two teams. This inturn implies that the number of matches is $\dbinom{n+1}2$.
• We will now count the number of distinct matches played team by team.
• The number of matches played by the first team is $n$.
• The number of matches played by the second team is $n-1$, since their match with the first team has already been accounted for.
• The number of matches played by the third team is $n-2$, since their matches with the first and second team have already been accounted for.
• The number of matches played by the $k^{th}$ team is $n-k+1$, since their matches with the first $k-1$ teams have already been accounted for. Hence, the total number of matches is $$n+(n-1) + (n-2) + \cdots + 1$$
• While all the answers have been helpful, this one was pedagogically best for my grasping the intuition. Very clear explanation. – user238435 May 8 '15 at 16:37

Suppose that you want to choose a subset $\{m,n\}$ with two elements of the set $$\{1,2,\dotsc,n+1\}$$ Count this in two ways one of them naturally equals $\binom {n+1}2$ and for the other observe that

If $max\{m,n\}=2$ then we have one subsets $\{m,n\}$.
If $max\{m,n\}=3$ then we have two subsets $\{m,n\}$.
$\vdots$
If $max\{m,n\}=n+1$ then we have $n$ subsets $\{m,n\}$.

Now add up these cases to derive the identity.$\square$

This is the classic proof without words, from https://maybemath.wordpress.com/

That doesn't help with this part of your question:

Why does the sum of the first $n$ natural numbers count the number of ways I can choose a pair out of $n+1$ objects?

Here's a way to rephrase @user17762 's excellent accepted answer.

Imagine $n+1$ kids in a room. Each shakes hands with all the others. Then each kid shakes hands $n$ times, so there are $n(n+1)$ handshakes - each counted twice. You can pick a pair of kids (that is, a handshake) in $n(n+1)/2$ ways. But you can also think about the kids shaking hands as they enter the room one at a time. The second kid coming has one hand to shake. The third has two, and so on, for a total of $1 + 2 + \cdots + n$.

The intuition is that for the pairs can be listed in the following way.

$$\begin{array}{ccccccc} 1,2 & & & & & & \\ 1,3 & 2,3 & & & & & \\ 1,4 & 2,4 & 3,4 & & & & \\ 1,5 & 2,5 & 3,5 & 4,5 & & & \\ 1,6 & 2,6 & 3,6 & 4,6 & 5,6 & & \\ 1,\vdots & 2,\vdots & 3,\vdots & 4,\vdots & 5,\vdots &\ddots & \\ 1,n+1 & 2,n+1 & 3,n+1 & 4,n+1 & 5,n+1 & \cdots & n,n+1 \\ \end{array}$$

Notice that each row has length $i$ for $i=1,\ldots,n$ since the number of pairs with maximum element $i+1$ is $i$. Therefore the total number of pairs, which is $\binom{n+1}{2}$ is $\displaystyle \sum_{i=1}^n i$.

• I doubt the person who downvoted this post will see this, but if you do, I would appreciate it in the future if you left an explanation as to why it was downvoted so that I could fix my post. – jgon May 8 '15 at 18:30

If you want to choose a pair out of $n+1$ objects (for example, $\{0,1,\dots,n\}$), the possibilities are:

$\{0,1\}$, $\{0,2\}$, ..., $\{0,n\}$, giving $n$ possibilities.

$\{1,2\}$, $\{1,3\}$, ..., $\{1,n\}$ giving $n-1$ possibilities. (note that we've already picked $\{1,0\}$, so we can't repeat it here)

$\{2,3\}$, $\{2,4\}$, ..., $\{2,n\}$ giving $n-2$ possibilities.

$\ \ \ \ \vdots$

$\{n-2,n-1\}$, $\{n-2,n\}$ giving $2$ possibilities.

$\{n-1,n\}$ giving $1$ possibility.

So the number of pairs is $n+(n-1)+\dots+2+1$

• @jgon Oh, I missed that. Thanks – Kitegi May 9 '15 at 8:16

Start with $n+1$ objects, labelled $1,\dots,n+1$. We count the number of ways of choosing a pair of objects. We may always assume that the first object we choose has a lower number than the second.

Choose object number $1$. How many ways are there to choose a second object with a higher number?

Choose object number $2$. How many ways are there to choose a second object with a higher number?

Choose object number $3$. How many ways are there to choose a second object with a higher number?

$$\dots$$

Choose object number $n$. How many ways are there to choose a second object with a higher number?

Choose object number $n+1$. How many ways are there to choose a second object with a higher number?


# Proving formula involving Euler's totient function

This question is motivated by lhf's comment here .

"It'd be nice to relate this formula with the natural mapping $U_{mn} \to U_m \times U_n$ by proving that the kernel has size $d$ and the image has index $\varphi(d)$."

I'm trying to prove the formula $$\varphi(mn) = \varphi(m)\varphi(n) \frac{d}{\varphi(d)}$$ by considering the natural map $\eta\colon U_{mn} \to U_m \times U_n$ (i.e. the map sending $\overline{x} \mapsto (\overline{x},\overline{x})$, where the bar denotes reduction mod $mn$, $m$, or $n$, respectively).

I've been able to show that the kernel has the right size as follows:

The kernel of $\eta$ consists of the elements $\overline{x} \in U_{mn}$ with $x \equiv 1 \bmod m$ and $x \equiv 1 \bmod n$. The integers $x$ which satisfy these conditions are those of the form $x = \frac{mn}{d}k + 1$ for $k \in \mathbb Z$. On the other hand, any such integer $x$ is relatively prime to $mn$, and hence gives and element $\overline{x} \in U_{mn}$. Therefore, $\ker \eta$ consists of the $d$ distinct elements $\overline{x}$, where $x = \frac{mn}{d}k + 1$ and $k \in \{1,\ldots,d\}$.

Once it has been shown that the image has index $\varphi(d)$, the first isomorphism theorem gives $$\frac{U_{mn}}{\ker \eta} \cong Im(\eta),$$ and so $$\frac{\varphi(mn)}{d} = \frac{|U_{mn}|}{|\ker \eta|} = |Im(\eta)| = \frac{|U_m \times U_n|}{|U_m \times U_n:Im(\eta)|} = \frac{\varphi(m)\varphi(n)}{\varphi(d)},$$ or $$\varphi(mn) = \varphi(m)\varphi(n) \frac{d}{\varphi(d)}.$$

I'm having trouble showing the image has the right index.

I've noticed that $\eta(\overline{x}) = \eta(\overline{x + \frac{mn}{d}})$, so the image consists the images of the elements $\overline{x}$ with $1 \leq x < \frac{mn}{d}$. I'm not sure if this is going anywhere, though. Any suggestions?

-
I got stuck at the same point... Thanks for turning my comment to a question. – lhf Mar 14 '12 at 12:04

I'll adjust your notation a bit, using $x\in U_{mn}$ for an invertible element of $\mathbb{Z}/mn\mathbb{Z}$, using $\bar x\in U_m$ for the residue class of $x$ modulo $m$, and using $\tilde x \in U_n$ for the residue class of $x$ modulo $n$.

The image of your map $x \mapsto (\bar x,\tilde x)$ is generally smaller than $U_m \times U_n$ because $\bar x$ and $\tilde x$ will always be the same modulo $d$. We first choose a reduced residue system $\{a_1=1, a_2, \ldots, a_{\varphi(d)}\}$ modulo $d$ from the elements $U_{n}$ and consider the images of the maps $f_i: x \mapsto (\bar x, a_i\tilde x)$. (Note that each $a_i$ is invertible modulo $n$.) It's clear that the images of these maps are disjoint, have the same size, and that we are studying the special case $f_1:x \mapsto (\bar x, \tilde x)$. In fact, the union of these images is all of $U_m \times U_n$, as we now show.

Take any $(y,z) \in U_m \times U_n$. We show it is equal to some $f_i(x)$ where $a_i \equiv zy^{-1} \pmod{d}$. By a slight generalization of the Chinese Remainder Theorem, there is a unique $x$ modulo $\frac{mn}{d}$ such that $$x \equiv y \pmod{m}\qquad \qquad \text{and} \qquad \qquad x \equiv z{a_i}^{-1} \pmod{n}.$$ Then $f_i(x)=(\bar x, a_i \tilde x) =(y,z)$. (In fact, the $d$ preimages of $(y,z)$ are the elements $x+\frac{mn}{d} k$ with $0 \leq k \leq d-1$.)

A generalization of the Chinese Remainder Theorem is required because $m$ and $n$ share the factor $d$. Such systems of congruences have a solution as long as they are compatible modulo $d$, and this solution is unique modulo $\rm{lcm}(m,n)=\frac{mn}{d}$. Our system is compatible modulo $d$, since $y \equiv z {a_i}^{-1} \pmod{d}$.

Thus, the index of the image of $x \mapsto (\bar x, \tilde x)$ is $\varphi(d)$.

-

Jonas Kibelbek directly proved that the index of the image of $\eta$ is $\phi(d),$ and below is an alternative by proving an exact sequence, which I hope might clarify the matter somewhat.

The exact sequence I want to prove is

$$0\rightarrow \text{Ker}(f)\rightarrow U_{mn}\overset{f}{\rightarrow}U_m\times U_n\overset{g}{\rightarrow} U_d\rightarrow0,$$

where $f(x+mn\mathbb Z)=(x+m\mathbb Z, x+n\mathbb Z),$ and $g(x+m\mathbb Z, y+n\mathbb Z)=xy^{-1}+d\mathbb Z$ (Here the inverse is taken modulo $d$).
Proof:
Firstly, $\forall (a+d\mathbb Z)\in U_d,$ we have that $g(a+m\mathbb Z, 1+n\mathbb Z)=(a+d\mathbb Z),$ so $g$ is surjective. Further, it is clear that $g\circ f$ vanishes. Conversely, if $(x+m\mathbb Z, y+n\mathbb Z)\in U_m\times U_n$ is such that $x\equiv y\pmod d,$ then, by a slight generalisation of Chinese rmainder theorem, as in Kibelbek's answer, $\exists z$ such that $\begin{cases}z\equiv x\pmod m\\z\equiv y\pmod n\end{cases}.$ Thus the sequence is exact. Q.E.D.

P.S. This sequence is in essence the sequence in this answer, with some reductions and modifications; I mark this answer as CW, for there is nothing new in this answer.

-


## anonymous one year ago I need help to prove that $$\binom{n}{0}^2 + \binom{n}{1}^2 + \cdots + \binom{n}{n}^2 = \binom{2n}{n}.$$ using committee forming...

1. ganeshie8

suppose there are $$n$$ men and $$n$$ women and you want to choose a committee consisting of $$n$$ people

2. anonymous

thats 2n choose n

3. ganeshie8

Yes, lets count it in an alternative way

4. ganeshie8

how many committees will be there with out women ?

5. anonymous

*

6. anonymous

1

7. ganeshie8

Yes, how many committees will be there with exactly 1 women ?

8. anonymous

n choose n-1

9. ganeshie8

try again

10. anonymous

n choose n-1 multiplied by n?

11. ganeshie8

you can choose $$1$$ women from the group of $$n$$ women in $$\binom{n}{1}$$ ways after that, the remaining $$n-1$$ men can be chosen from the group of $$n$$ men in $$\binom{n}{n-1}$$ ways so total $$n$$ member committees with exactly $$1$$ women is $$\binom{n}{1}*\binom{n}{n-1}$$

12. ganeshie8

does that make sense

13. anonymous

yes, i get it

14. anonymous

now would i find the number of ways to make a committee with two women?

15. ganeshie8

yes find it, after that you will see the pattern

16. anonymous

alright, ill get back to you with the results :D

17. ganeshie8

take your time, we're almost done!

18. anonymous

hang on... n choose k and n choose (n-k) give the same result

19. anonymous

so the total possible combinations is just sums of the squares....

20. ganeshie8

Yep!

21. anonymous

but how do i equate it to 2n choose n?

22. anonymous

oh wait nevermind

23. anonymous

i get it

24. ganeshie8

good :) id like to see the complete proof if you don't mind

25. anonymous

sure :D

26. ganeshie8

take a screenshot and attach if psble

27. anonymous

i need to go eat dinner, i'll send it to you in about an hour, is that ok?

28. ganeshie8

take ur time

29. anonymous

i also need to prove the same thing using the "block walking" method... but i dont know how. Do you think you can try to help me with this too? please?

30. ganeshie8

sure that is also an interesting way to count first, may i see the previous proof...

31. anonymous

yes im just typing it up now

32. anonymous

sorry the codeisnt working...

33. ganeshie8

make this correction : $$k\le n$$

34. ganeshie8

other than that, the proof looks good!

35. anonymous

ok thanks!

36. anonymous

can you help me with the second part please?

37. anonymous

hello? are you still here @ganeshie8

38. ganeshie8

Hey!

39. anonymous

40. ganeshie8

Consider a $$n\times n$$grid |dw:1440165928386:dw|

41. anonymous

right

42. anonymous

number of paths from bottom left to top right = $$\binom{2n}{n}$$ |dw:1440168478785:dw|

43. anonymous

suppose your friend's home is located at $$(k,~n-k)$$, where $$k\in \left\{0,1,2,\ldots ,n \right\}$$. then number of paths through $$(k,n-k)$$ is given by $$\binom{n}{k}*\binom{n}{n-k} = \binom{n}{k}^2$$ ..... https://proofwiki.org/wiki/Sum_of_Squares_of_Binomial_Coefficients


A cube root of a number a is a number x such that x3 = a, in other words, a number x whose cube is a. So, in this case the cube root of 125 is 5. Thus, each edge of the cube is 5 cm long. The length of a side (edge) of a cube is equal to the cube root of the volume. 125 is said to be a perfect cube because 5 x 5 x 5 is equal to 125. How to find the square root of 125 by long division method Here we will show you how to calculate the square root of 125 using the long division method with one decimal place accuracy. Let's check this with ∛125*1=∛125. Having trouble with your homework? How long does it take to cook a 23 pound turkey in an oven? Free math problem solver answers your algebra, geometry, trigonometry, calculus, and statistics homework questions with step-by-step explanations, just like a math tutor. Step 1) Set up 125 in pairs of two digits from right to left and attach one set of 00 because we want one decimal: … First we will find all factors under the cube root: 125 has the cube factor of 125. 5³ = 5 * 5 * 5 = 25 * 5 = 125 So the cube root of 125 is 5. The cube root of 125 is 5 so therefore each edge is 5 cm which is about 2 inches Yes, simply enter the fraction as a decimal floating point number and you will get the corresponding cube root. See next answers. Thus, each edge of the cube is 5 cm long. Thus, each edge of the cube is 5 cm long. After 42 months, Sally earned $238 in simple interest. Estimating higher n th roots, even if using a calculator for intermediary steps, is … How will understanding of attitudes and predisposition enhance teaching? 'CUBE ROOT OF 125' is a 13 letter phrase starting with C and ending with 5 Crossword clues for 'CUBE ROOT OF 125' Synonyms, crossword answers and other related words for CUBE ROOT OF 125 [five] We hope that the following list of synonyms for the word five will help you to finish your crossword today. Here is the answer to questions like: What is the cube root of 125 or what is the cube root of 125? WHO WANNA JOIN MY … 125 can be written as 125(e^0), 125(e^((2pi)i)), 125(e^((4pi)i)) where e is euler’s number, i is the imaginary unit, i^2=-1, and e^((theta)i)=cos(theta)+(i)(sin(theta)) where theta is an angle measured in radians. The cube root of -64 is written as $$\sqrt[3]{-64} = -4$$. Inter state form of sales tax income tax? cube root of 125/512 = 5/8. Volume to (Weight) Mass Converter for Recipes, Weight (Mass) to Volume to Converter for Recipes. Therefore the cube roots of 125 are 5(e^0),5(e^((2pi)i/3)),5(e^((4pi)i/3)). What is the birthday of carmelita divinagracia? When did organ music become associated with baseball? What is the conflict of the story of sinigang? What is plot of the story Sinigang by Marby Villaceran? The nearest previous perfect cube is … The cube root of a number answers the question "what number can I multiply by itself twice to get this number?". The length of a side (edge) of a cube is equal to the cube root of the volume. Not sure about the answer? Why don't libraries smell like bookstores? The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply. Cube Root of 125. Find the interest rate … that Sally earned from the bank. That number is 5. Who of the proclaimers was married to a little person? For example, 5 is the cube root of 125 because 53 = 5•5•5 = 125, -5 is cube root of -125 because (-5)3 = (-5)•(-5)•(-5) = -125. Just right click on the above image, then choose copy link address, then past it in your HTML. Cube of ∛125=5 which results into 5∛1; All radicals are now simplified. What is the contribution of candido bartolome to gymnastics? Is evaporated milk the same thing as condensed milk? So, in this case the cube root of 125 is 5. Guess: 5.125 27 ÷ 5.125 = 5.268 (5.125 + 5.268)/2 = 5.197 27 ÷ 5.197 = 5.195 (5.195 + 5.197)/2 = 5.196 27 ÷ 5.196 = 5.196 Estimating an n th Root. Therefore, the real cube root of 125 is 5. Get free help! 5(e^0)=5(1)=0 Copyright © 2020 Multiply Media, LLC. Someone help me with this ASAP ANSWER QUICK! This is the lost art of how they calculated the square root of 125 by hand before modern technology was invented. See also our cube root table from 1 to 1000. New questions in Mathematics. Learn more with Brainly! Who is the longest reigning WWE Champion of all time? The cube root of -8 is written as $$\sqrt[3]{-8} = -2$$. That number is 5. Does the calculator support fractions? A cube root of a number a is a number x such that x 3 = a, in other words, a number x whose cube is a. Since 125 is a whole number, it is a perfect cube. Now extract and take out the cube root ∛125 * ∛1. 80% of questions are answered in under 10 minutes Answers come with explanations, so that … Sally deposited$850 into her bank account for 42 months. How long will it take to cook a 12 pound turkey? ... ∛125: 5 ∛216: 6 ∛1,000: 10 ∛1,000,000: 100 ∛1,000,000,000: 1000: The calculations were performed using this cube root calculator. For example, 5 is the cube root of 125 because 5 3 = 5•5•5 = 125, -5 is cube root of -125 because (-5) 3 = (-5)• (-5)• (-5) = -125. What details make Lochinvar an attractive and romantic figure? As you can see the radicals are not in their simplest form. All information in this site is provided “as is”, with no guarantee of completeness, accuracy, timeliness or of the results obtained from the use of this information. Cube roots (for integer results 1 through 10) Cube root of 1 is 1; Cube root of 8 is 2; Cube root of 27 is 3; Cube root of 64 is 4; Cube root of 125 is 5; Cube root of 216 is 6; Cube root of 343 is 7; Cube root of 512 is 8; Cube root of 729 is 9


# setting of this induction proof [duplicate]

I would like to see if this is a correct induction proof and whether or not this is a good setting out of it
A sequence is defined by $$a_n = a_{n-1} + a_{n-2} + a_{n-3}$$ for $n\geq 3, a_0 = 1, a_1 = 2, a_2 = 4$.
Prove that $a_n \leq 4^n$ for all $n\in\mathbb{N}$.

Let $P(n)$ be the proposition that $$''a_n\leq 4^n{''}.$$

Now since we have $a_0 = 1 = 4^0 \leq 4^0$ then $a_0 \leq 4^0$.
Also, $a_1 = 2 < 4 \leq 4 = 4^1$ then $a_1 \leq 4^1$.
Also, $a_2 = 4<16 = 4^2 \leq 4^2$ so $a_2 \leq 4^2$.

Hence, $P(0),P(1),P(2)$ are true.

Now, let $k-3\in\mathbb{N}$ and suppose $P(k-3),P(k-2),P(k-1)$ is true.
We must show that $P(k)$ is true.

Now by definition \begin{align}a_n &= a_{n-1} + a_{n-2} + a_{n-3} \\ &\leq 4^{n-1} + 4^{n-2} + 4^{n-3} \qquad \text{by the inductive hypothesis}\\ &= 21\times 4^{k-3} \\ &\leq 64\times 4^{k-3} \\ &= 4^{k}.\end{align}

Hence, $P(k)$ is true if $P(k-3),P(k-2),P(k-1)$ is true for $k\geq 3$.
So by induction, $P(n)$ is true for all $n\in\mathbb{N}$.

• Looks good to me. – learning Nov 10 '17 at 8:02

Suppose that $P(n)$ is true and prove it for $P(n+1)$

$a_n = a_{n-1} + a_{n-2} + a_{n-3}\quad$ by the inductive hypothesis

if we suppose that $P(k)$ is true for any $1\leq k\leq n$ we are using strong induction

We must prove that

$a_{n+1}\leq 4^{n+1}$

$a_{n+1}=a_n + a_{n-1} + a_{n-2} \leq 4^n+4^{n-1}+4^{n-2}=4^{n-2}\left(4^2+4+1\right)=21\cdot 4^{n-2}\leq 64\cdot 4^{n-2}=4^{n+1}$

proved

Hope this helps

• Is my assumption sentence incorrect then? – OneGapLater Nov 10 '17 at 9:13
• Induction works in this way: P(1) is true, if $P(n)$ is true then $P(n+1)$ is true. End. You assumed $P(n-2),P(n-1),P(n)$ true and proved $P(n+1)$ then formally you used strong induction, which is explained in my answer. The core of your proof is correct. My answer is just to adjust some formal detail. – Raffaele Nov 10 '17 at 11:08
• I see, so formal strong induction is assuming (in my case) for all $3\leq i \leq k$ and $k\geq 3$ is true. (but really, I only need to use the values $i=k-3,k-2,k-1$ in my proof?) – OneGapLater Nov 11 '17 at 4:15
• @ActuarialStudent101 Formally you did not use strong induction because your hypothese was not the statement "$P(i)$ is true for all $i<k$". With normal induction ("$P(n)$ true implies $P(n+1)$ true") you cannot reach your goal. Nevertheless you did reach your goal with normal induction. This because you focused not on $P(n)$ but on the $Q(n)$ in my answer. Beautiful about induction is that sometimes you can make things easyer by enforcing the hypothese. A possible bonus is then that you also prove more. – drhab Nov 11 '17 at 9:00

Actually you proved that $\forall n\in\mathbb N\, [Q(n)]$ where $Q(n)$ is stated by:$$\forall n\in\mathbb N [P(n)\wedge P(n+1)\wedge P(n+2)]$$
Of course $\forall n\in\mathbb N\, [P(n)]$ is a direct consequence of $\forall n\in\mathbb N\, [Q(n)]$


# Finding the Area bounded by the curve

#### shamieh

##### Active member
Find the area bounded by the curve $$\displaystyle x = 16 - y^4$$ and the y axis.

I need someone to check my work.

so I know this is a upside down parabola so I find the two x coordinates which are

$$\displaystyle 16 - y^4 = 0$$
$$\displaystyle y^4 = 16$$
$$\displaystyle y^2 = +- \sqrt{4}$$
$$\displaystyle y = +- 2$$

so I know

$$\displaystyle \int^2_{-2} 16 - y^4 dy$$

Take antiderivative

$$\displaystyle 16y - \frac{1}{5}y^5$$ | -2 to 2

so $$\displaystyle (2) = 32 - \frac{32}{5} = \frac{160}{5}$$

then $$\displaystyle (-2) = -32 - (\frac{-32}{5}) = -32 + \frac{32}{5} = \frac{-160}{5} + \frac{32}{5} = \frac{-128}{5}$$

SO finally
$$\displaystyle [\frac{160}{5}] - [\frac{-128}{5}] = \frac{288}{5}$$

#### ZaidAlyafey

##### Well-known member
MHB Math Helper
This is not a parabola. It is like a parabola that intersects the y-axis at $$\displaystyle y=\pm 2$$ so it is open to the left. I suggest you revise your calculations.

#### MarkFL

Staff member
I would use the even-function rule to state:

$$\displaystyle A=2\int_0^2 16-y^4\,dy=\frac{2}{5}\left[80y-y^5 \right]_0^2=?$$

#### shamieh

##### Active member
Recalculated answer below if someone has a chance to check.

Last edited:

#### shamieh

##### Active member
recalculated and got $$\displaystyle \frac{256}{5}$$ . Is that correct?

- - - Updated - - -

I would use the even-function rule to state:

$$\displaystyle A=2\int_0^2 16-y^4\,dy=\frac{2}{5}\left[80y-y^5 \right]_0^2=?$$
Yea this rule is so much easier!

- - - Updated - - -

Mark, know anywhere where I can find a good definition of the even function rule, so I can see how and when I can apply it etc. I googled it but couldn't find this one.

#### shamieh

##### Active member
Like how would I use this rule if i had $$\displaystyle 5 - x^2$$?

#### MarkFL

Staff member
recalculated and got $$\displaystyle \frac{256}{5}$$ . Is that correct?

- - - Updated - - -

Yea this rule is so much easier!

- - - Updated - - -

Mark, know anywhere where I can find a good definition of the even function rule, so I can see how and when I can apply it etc. I googled it but couldn't find this one.
Yes, your result of $$\displaystyle A=\frac{256}{5}$$ is correct.

An even function is symmetric about the $y$-axis, i.e., $$\displaystyle f(-x)=f(x)$$. If your limits of integration are also symmetric about the $y$-axis, then you may apply the even function rule.

Observe that:

$$\displaystyle \int_{-a}^a f(x)\,dx=\int_{-a}^0 f(x)\,dx+\int_0^a f(x)\,dx$$

Now, in the first integral, if we replace $x$ with $-x$, we have:

$$\displaystyle \int_{-a}^a f(x)\,dx=\int_{a}^0 f(-x)\,-dx+\int_0^a f(x)\,dx$$

Bringing the negative in front of the differential out front and using $$\displaystyle f(-x)=f(x)$$, we have:

$$\displaystyle \int_{-a}^a f(x)\,dx=-\int_{a}^0 f(x)\,-dx+\int_0^a f(x)\,dx$$

Applying the FTOC, we obtain:

$$\displaystyle \int_{-a}^a f(x)\,dx=-\left(F(0)-F(a) \right)+F(a)-F(0)=2F(a)=2\int_0^a f(x)\,dx$$

#### ZaidAlyafey

##### Well-known member
MHB Math Helper
Yes, your result of $$\displaystyle A=\frac{256}{5}$$ is correct.

An even function is symmetric about the $y$-axis, i.e., $$\displaystyle f(-x)=f(x)$$. If your limits of integration are also symmetric about the $y$-axis, then you may apply the even function rule.

Observe that:

$$\displaystyle \int_{-a}^a f(x)\,dx=\int_{-a}^0 f(x)\,dx+\int_0^a f(x)\,dx$$

Now, in the first integral, if we replace $x$ with $-x$, we have:

$$\displaystyle \int_{-a}^a f(x)\,dx=\int_{a}^0 f(-x)\,-dx+\int_0^a f(x)\,dx$$

Bringing the negative in front of the differential out front and using $$\displaystyle f(-x)=f(x)$$, we have:
$$\displaystyle \int_{-a}^a f(x)\,dx=-\int_{a}^0 f(x)\,dx+\int_0^a f(x)\,dx=\int_{0}^a f(x)\,dx+\int_0^a f(x)\,dx=2\int^a_0 f(x)\, dx$$


Code should execute sequentially if run in a Jupyter notebook

# Linear Algebra¶

## Overview¶

Linear algebra is one of the most useful branches of applied mathematics for economists to invest in

For example, many applied problems in economics and finance require the solution of a linear system of equations, such as

$\begin{split}\begin{array}{c} y_1 = a x_1 + b x_2 \\ y_2 = c x_1 + d x_2 \end{array}\end{split}$

or, more generally,

(1)$\begin{split}\begin{array}{c} y_1 = a_{11} x_1 + a_{12} x_2 + \cdots + a_{1k} x_k \\ \vdots \\ y_n = a_{n1} x_1 + a_{n2} x_2 + \cdots + a_{nk} x_k \end{array}\end{split}$

The objective here is to solve for the “unknowns” $$x_1, \ldots, x_k$$ given $$a_{11}, \ldots, a_{nk}$$ and $$y_1, \ldots, y_n$$

When considering such problems, it is essential that we first consider at least some of the following questions

• Does a solution actually exist?
• Are there in fact many solutions, and if so how should we interpret them?
• If no solution exists, is there a best “approximate” solution?
• If a solution exists, how should we compute it?

These are the kinds of topics addressed by linear algebra

In this lecture we will cover the basics of linear and matrix algebra, treating both theory and computation

We admit some overlap with this lecture, where operations on Julia arrays were first explained

Note that this lecture is more theoretical than most, and contains background material that will be used in applications as we go along

## Vectors¶

A vector of length $$n$$ is just a sequence (or array, or tuple) of $$n$$ numbers, which we write as $$x = (x_1, \ldots, x_n)$$ or $$x = [x_1, \ldots, x_n]$$

We will write these sequences either horizontally or vertically as we please

(Later, when we wish to perform certain matrix operations, it will become necessary to distinguish between the two)

The set of all $$n$$-vectors is denoted by $$\mathbb R^n$$

For example, $$\mathbb R ^2$$ is the plane, and a vector in $$\mathbb R^2$$ is just a point in the plane

Traditionally, vectors are represented visually as arrows from the origin to the point

The following figure represents three vectors in this manner

#=

@author : Spencer Lyon <spencer.lyon@nyu.edu>
Victoria Gregory <victoria.gregory@nyu.edu>

=#

using Plots
pyplot()
using LaTeXStrings

vecs = ([2, 4], [-3, 3], [-4, -3.5])
x_vals = zeros(2, length(vecs))
y_vals = zeros(2, length(vecs))
labels = []

# Create matrices of x and y values, labels for plotting
for i = 1:length(vecs)
v = vecs[i]
x_vals[2, i] = v[1]
y_vals[2, i] = v[2]
labels = [labels; (1.1 * v[1], 1.1 * v[2], "$v")] end plot(x_vals, y_vals, arrow=true, color=:blue, legend=:none, xlims=(-5, 5), ylims=(-5, 5), annotations=labels, xticks=-5:1:5, yticks=-5:1:5, framestyle=:origin) ### Vector Operations¶ The two most common operators for vectors are addition and scalar multiplication, which we now describe As a matter of definition, when we add two vectors, we add them element by element $\begin{split}x + y = \left[ \begin{array}{c} x_1 \\ x_2 \\ \vdots \\ x_n \end{array} \right] + \left[ \begin{array}{c} y_1 \\ y_2 \\ \vdots \\ y_n \end{array} \right] := \left[ \begin{array}{c} x_1 + y_1 \\ x_2 + y_2 \\ \vdots \\ x_n + y_n \end{array} \right]\end{split}$ Scalar multiplication is an operation that takes a number $$\gamma$$ and a vector $$x$$ and produces $\begin{split}\gamma x := \left[ \begin{array}{c} \gamma x_1 \\ \gamma x_2 \\ \vdots \\ \gamma x_n \end{array} \right]\end{split}$ Scalar multiplication is illustrated in the next figure # illustrate scalar multiplication x = [2, 2] scalars = [-2, 2] # Create matrices of x and y values, labels for plotting x_vals = zeros(2, 1 + length(scalars)) y_vals = zeros(2, 1 + length(scalars)) labels = [] x_vals[2, 3] = x[1] y_vals[2, 3] = x[2] labels = [labels; (x[1] + 0.4, x[2] - 0.2, L"$x$")] # Perform scalar multiplication, store results in plotting matrices for i = 1:length(scalars) s = scalars[i] v = s .* x x_vals[2, i] = v[1] y_vals[2, i] = v[2] labels = [labels; (v[1] + 0.4, v[2] - 0.2, LaTeXString("\$$s x\$"))]
end

plot(x_vals, y_vals, arrow=true, color=[:red :red :blue],
legend=:none, xlims=(-5, 5), ylims=(-5, 5),
annotations=labels, xticks=-5:1:5, yticks=-5:1:5,
framestyle=:origin)

In Julia, a vector can be represented as a one dimensional Array

Julia Arrays allow us to express scalar multiplication and addition with a very natural syntax

x = ones(3)
3-element Array{Float64,1}:
1.0
1.0
1.0
y = [2, 4, 6]
3-element Array{Int64,1}:
2
4
6
x + y
3-element Array{Float64,1}:
3.0
5.0
7.0
4x  # equivalent to 4 * x and 4 .* x
3-element Array{Float64,1}:
4.0
4.0
4.0

### Inner Product and Norm¶

The inner product of vectors $$x,y \in \mathbb R ^n$$ is defined as

$x' y := \sum_{i=1}^n x_i y_i$

Two vectors are called orthogonal if their inner product is zero

The norm of a vector $$x$$ represents its “length” (i.e., its distance from the zero vector) and is defined as

$\| x \| := \sqrt{x' x} := \left( \sum_{i=1}^n x_i^2 \right)^{1/2}$

The expression $$\| x - y\|$$ is thought of as the distance between $$x$$ and $$y$$

Continuing on from the previous example, the inner product and norm can be computed as follows

dot(x, y)               # Inner product of x and y
12.0
sum(x .* y)             # Gives the same result
12.0
norm(x)                 # Norm of x
1.7320508075688772
sqrt(sum(x.^2))         # Gives the same result
1.7320508075688772

### Span¶

Given a set of vectors $$A := \{a_1, \ldots, a_k\}$$ in $$\mathbb R ^n$$, it’s natural to think about the new vectors we can create by performing linear operations

New vectors created in this manner are called linear combinations of $$A$$

In particular, $$y \in \mathbb R ^n$$ is a linear combination of $$A := \{a_1, \ldots, a_k\}$$ if

$y = \beta_1 a_1 + \cdots + \beta_k a_k \text{ for some scalars } \beta_1, \ldots, \beta_k$

In this context, the values $$\beta_1, \ldots, \beta_k$$ are called the coefficients of the linear combination

The set of linear combinations of $$A$$ is called the span of $$A$$

The next figure shows the span of $$A = \{a_1, a_2\}$$ in $$\mathbb R ^3$$

The span is a 2 dimensional plane passing through these two points and the origin

x_min, x_max = -5, 5
y_min, y_max = -5, 5

α, β = 0.2, 0.1

# Axes
gs = 3
z = linspace(x_min, x_max, gs)
x = zeros(gs)
y = zeros(gs)
plot(x, y, z, color=:black, linewidth=2, alpha=0.5, label="", legend=false)
plot!(z, x, y, color=:black, linewidth=2, alpha=0.5, label="")
plot!(y, z, x, color=:black, linewidth=2, alpha=0.5, label="")

# Fixed linear function, to generate a plane
f(x, y) = α .* x + β .* y

# Vector locations, by coordinate
x_coords = [3, 3]
y_coords = [4, -4]
z = f(x_coords, y_coords)

# Lines to vectors
n = 2
x_vec = zeros(n, n)
y_vec = zeros(n, n)
z_vec = zeros(n, n)
labels = []

for i=1:n
x_vec[:, i] = [0; x_coords[i]]
y_vec[:, i] = [0; y_coords[i]]
z_vec[:, i] = [0; f(x_coords[i], y_coords[i])]
lab = string("a", i)
push!(labels, lab)
end

plot!(x_vec, y_vec, z_vec, color=[:blue :red], linewidth=1.5,
alpha=0.6, label=labels)

# Draw the plane
grid_size = 20
xr2 = linspace(x_min, x_max, grid_size)
yr2 = linspace(y_min, y_max, grid_size)
z2 = Array{Float64}(grid_size, grid_size)
for i in 1:grid_size
for j in 1:grid_size
z2[j, i] = f(xr2[i], yr2[j])
end
end
surface!(xr2, yr2, z2, cbar=false, alpha=0.2, fill=:blues,
xlims=(x_min, x_max), ylims=(x_min, x_max),
zlims=(x_min, x_max), xticks=[0], yticks=[0],
zticks=[0])

#### Examples¶

If $$A$$ contains only one vector $$a_1 \in \mathbb R ^2$$, then its span is just the scalar multiples of $$a_1$$, which is the unique line passing through both $$a_1$$ and the origin

If $$A = \{e_1, e_2, e_3\}$$ consists of the canonical basis vectors of $$\mathbb R ^3$$, that is

$\begin{split}e_1 := \left[ \begin{array}{c} 1 \\ 0 \\ 0 \end{array} \right] , \quad e_2 := \left[ \begin{array}{c} 0 \\ 1 \\ 0 \end{array} \right] , \quad e_3 := \left[ \begin{array}{c} 0 \\ 0 \\ 1 \end{array} \right]\end{split}$

then the span of $$A$$ is all of $$\mathbb R ^3$$, because, for any $$x = (x_1, x_2, x_3) \in \mathbb R ^3$$, we can write

$x = x_1 e_1 + x_2 e_2 + x_3 e_3$

Now consider $$A_0 = \{e_1, e_2, e_1 + e_2\}$$

If $$y = (y_1, y_2, y_3)$$ is any linear combination of these vectors, then $$y_3 = 0$$ (check it)

Hence $$A_0$$ fails to span all of $$\mathbb R ^3$$

### Linear Independence¶

As we’ll see, it’s often desirable to find families of vectors with relatively large span, so that many vectors can be described by linear operators on a few vectors

The condition we need for a set of vectors to have a large span is what’s called linear independence

In particular, a collection of vectors $$A := \{a_1, \ldots, a_k\}$$ in $$\mathbb R ^n$$ is said to be

• linearly dependent if some strict subset of $$A$$ has the same span as $$A$$
• linearly independent if it is not linearly dependent

Put differently, a set of vectors is linearly independent if no vector is redundant to the span, and linearly dependent otherwise

To illustrate the idea, recall the figure that showed the span of vectors $$\{a_1, a_2\}$$ in $$\mathbb R ^3$$ as a plane through the origin

If we take a third vector $$a_3$$ and form the set $$\{a_1, a_2, a_3\}$$, this set will be

• linearly dependent if $$a_3$$ lies in the plane
• linearly independent otherwise

As another illustration of the concept, since $$\mathbb R ^n$$ can be spanned by $$n$$ vectors (see the discussion of canonical basis vectors above), any collection of $$m > n$$ vectors in $$\mathbb R ^n$$ must be linearly dependent

The following statements are equivalent to linear independence of $$A := \{a_1, \ldots, a_k\} \subset \mathbb R ^n$$

1. No vector in $$A$$ can be formed as a linear combination of the other elements
2. If $$\beta_1 a_1 + \cdots \beta_k a_k = 0$$ for scalars $$\beta_1, \ldots, \beta_k$$, then $$\beta_1 = \cdots = \beta_k = 0$$

(The zero in the first expression is the origin of $$\mathbb R ^n$$)

### Unique Representations¶

Another nice thing about sets of linearly independent vectors is that each element in the span has a unique representation as a linear combination of these vectors

In other words, if $$A := \{a_1, \ldots, a_k\} \subset \mathbb R ^n$$ is linearly independent and

$y = \beta_1 a_1 + \cdots \beta_k a_k$

then no other coefficient sequence $$\gamma_1, \ldots, \gamma_k$$ will produce the same vector $$y$$

Indeed, if we also have $$y = \gamma_1 a_1 + \cdots \gamma_k a_k$$, then

$(\beta_1 - \gamma_1) a_1 + \cdots + (\beta_k - \gamma_k) a_k = 0$

Linear independence now implies $$\gamma_i = \beta_i$$ for all $$i$$

## Matrices¶

Matrices are a neat way of organizing data for use in linear operations

An $$n \times k$$ matrix is a rectangular array $$A$$ of numbers with $$n$$ rows and $$k$$ columns:

$\begin{split}A = \left[ \begin{array}{cccc} a_{11} & a_{12} & \cdots & a_{1k} \\ a_{21} & a_{22} & \cdots & a_{2k} \\ \vdots & \vdots & & \vdots \\ a_{n1} & a_{n2} & \cdots & a_{nk} \end{array} \right]\end{split}$

Often, the numbers in the matrix represent coefficients in a system of linear equations, as discussed at the start of this lecture

For obvious reasons, the matrix $$A$$ is also called a vector if either $$n = 1$$ or $$k = 1$$

In the former case, $$A$$ is called a row vector, while in the latter it is called a column vector

If $$n = k$$, then $$A$$ is called square

The matrix formed by replacing $$a_{ij}$$ by $$a_{ji}$$ for every $$i$$ and $$j$$ is called the transpose of $$A$$, and denoted $$A'$$ or $$A^{\top}$$

If $$A = A'$$, then $$A$$ is called symmetric

For a square matrix $$A$$, the $$i$$ elements of the form $$a_{ii}$$ for $$i=1,\ldots,n$$ are called the principal diagonal

$$A$$ is called diagonal if the only nonzero entries are on the principal diagonal

If, in addition to being diagonal, each element along the principal diagonal is equal to 1, then $$A$$ is called the identity matrix, and denoted by $$I$$

### Matrix Operations¶

Just as was the case for vectors, a number of algebraic operations are defined for matrices

Scalar multiplication and addition are immediate generalizations of the vector case:

$\begin{split}\gamma A = \gamma \left[ \begin{array}{ccc} a_{11} & \cdots & a_{1k} \\ \vdots & \vdots & \vdots \\ a_{n1} & \cdots & a_{nk} \\ \end{array} \right] := \left[ \begin{array}{ccc} \gamma a_{11} & \cdots & \gamma a_{1k} \\ \vdots & \vdots & \vdots \\ \gamma a_{n1} & \cdots & \gamma a_{nk} \\ \end{array} \right]\end{split}$

and

$\begin{split}A + B = \left[ \begin{array}{ccc} a_{11} & \cdots & a_{1k} \\ \vdots & \vdots & \vdots \\ a_{n1} & \cdots & a_{nk} \\ \end{array} \right] + \left[ \begin{array}{ccc} b_{11} & \cdots & b_{1k} \\ \vdots & \vdots & \vdots \\ b_{n1} & \cdots & b_{nk} \\ \end{array} \right] := \left[ \begin{array}{ccc} a_{11} + b_{11} & \cdots & a_{1k} + b_{1k} \\ \vdots & \vdots & \vdots \\ a_{n1} + b_{n1} & \cdots & a_{nk} + b_{nk} \\ \end{array} \right]\end{split}$

In the latter case, the matrices must have the same shape in order for the definition to make sense

We also have a convention for multiplying two matrices

The rule for matrix multiplication generalizes the idea of inner products discussed above, and is designed to make multiplication play well with basic linear operations

If $$A$$ and $$B$$ are two matrices, then their product $$A B$$ is formed by taking as its $$i,j$$-th element the inner product of the $$i$$-th row of $$A$$ and the $$j$$-th column of $$B$$

If $$A$$ is $$n \times k$$ and $$B$$ is $$j \times m$$, then to multiply $$A$$ and $$B$$ we require $$k = j$$, and the resulting matrix $$A B$$ is $$n \times m$$

As perhaps the most important special case, consider multiplying $$n \times k$$ matrix $$A$$ and $$k \times 1$$ column vector $$x$$

According to the preceding rule, this gives us an $$n \times 1$$ column vector

(2)$\begin{split}A x = \left[ \begin{array}{ccc} a_{11} & \cdots & a_{1k} \\ \vdots & \vdots & \vdots \\ a_{n1} & \cdots & a_{nk} \end{array} \right] \left[ \begin{array}{c} x_{1} \\ \vdots \\ x_{k} \end{array} \right] := \left[ \begin{array}{c} a_{11} x_1 + \cdots + a_{1k} x_k \\ \vdots \\ a_{n1} x_1 + \cdots + a_{nk} x_k \end{array} \right]\end{split}$

Note

$$A B$$ and $$B A$$ are not generally the same thing

Another important special case is the identity matrix

You should check that if $$A$$ is $$n \times k$$ and $$I$$ is the $$k \times k$$ identity matrix, then $$AI = A$$

If $$I$$ is the $$n \times n$$ identity matrix, then $$IA = A$$

### Matrices in Julia¶

Julia arrays are also used as matrices, and have fast, efficient functions and methods for all the standard matrix operations

You can create them as follows

A = [1 2
3 4]
2×2 Array{Int64,2}:
1  2
3  4
typeof(A)
Array{Int64,2}
size(A)
(2,2)

The size function returns a tuple giving the number of rows and columns

To get the transpose of A, use transpose(A) or, more simply, A'

There are many convenient functions for creating common matrices (matrices of zeros, ones, etc.) — see here

Since operations are performed elementwise by default, scalar multiplication and addition have very natural syntax

A = eye(3)
3×3 Array{Float64,2}:
1.0  0.0  0.0
0.0  1.0  0.0
0.0  0.0  1.0
B = ones(3, 3)
3×3 Array{Float64,2}:
1.0  1.0  1.0
1.0  1.0  1.0
1.0  1.0  1.0
2A
3×3 Array{Float64,2}:
2.0  0.0  0.0
0.0  2.0  0.0
0.0  0.0  2.0
A + B
3×3 Array{Float64,2}:
2.0  1.0  1.0
1.0  2.0  1.0
1.0  1.0  2.0

To multiply matrices we use the * operator

In particular, A * B is matrix multiplication, whereas A .* B is element by element multiplication

### Matrices as Maps¶

Each $$n \times k$$ matrix $$A$$ can be identified with a function $$f(x) = Ax$$ that maps $$x \in \mathbb R ^k$$ into $$y = Ax \in \mathbb R ^n$$

These kinds of functions have a special property: they are linear

A function $$f \colon \mathbb R ^k \to \mathbb R ^n$$ is called linear if, for all $$x, y \in \mathbb R ^k$$ and all scalars $$\alpha, \beta$$, we have

$f(\alpha x + \beta y) = \alpha f(x) + \beta f(y)$

You can check that this holds for the function $$f(x) = A x + b$$ when $$b$$ is the zero vector, and fails when $$b$$ is nonzero

In fact, it’s known that $$f$$ is linear if and only if there exists a matrix $$A$$ such that $$f(x) = Ax$$ for all $$x$$

## Solving Systems of Equations¶

Recall again the system of equations (1)

If we compare (1) and (2), we see that (1) can now be written more conveniently as

(3)$y = Ax$

The problem we face is to determine a vector $$x \in \mathbb R ^k$$ that solves (3), taking $$y$$ and $$A$$ as given

This is a special case of a more general problem: Find an $$x$$ such that $$y = f(x)$$

Given an arbitrary function $$f$$ and a $$y$$, is there always an $$x$$ such that $$y = f(x)$$?

If so, is it always unique?

The answer to both these questions is negative, as the next figure shows

#=

@author : Spencer Lyon <spencer.lyon@nyu.edu>
Victoria Gregory <victoria.gregory@nyu.edu>

=#

f(x) = 0.6 * cos(4.0 * x) + 1.3

xmin, xmax = -1.0, 1.0
Nx = 160
x = linspace(xmin, xmax, Nx)
y = f.(x)
ya, yb = minimum(y), maximum(y)

p1 = plot(x, y, color=:black, label=[L"$f$" ""], grid=false)
plot!(x, ya*ones(Nx, 1), fill_between=yb*ones(Nx, 1),
fillalpha=0.1, color=:blue, label="", lw=0)
plot!(zeros(2, 2), [ya ya; yb yb], lw=3, color=:blue, label=[L"range of $f$" ""])
annotate!(0.04, -0.3, L"$0$", ylims=(-0.6, 3.2))
vline!([0], color=:black, label="")
hline!([0], color=:black, label="")
plot!(foreground_color_axis=:white, foreground_color_text=:white,
foreground_color_border=:white)

ybar = 1.5
plot!(x, x .* 0 .+ ybar, color=:black, linestyle=:dash, label="")
annotate!(0.05, 0.8 * ybar, L"$y$")

x_vals = Array{Float64}(2, 4)
y_vals = Array{Float64}(2, 4)
labels = []
for (i, z) in enumerate([-0.35, 0.35])
x_vals[:, 2*i-1] = z*ones(2, 1)
y_vals[2, 2*i-1] = f(z)
labels = [labels; (z, -0.2, LaTeXString("\$x_$i\$"))] end plot!(x_vals, y_vals, color=:black, linestyle=:dash, label="", annotation=labels) p2 = plot(x, y, color=:black, label=[L"$f$" ""], grid=false) plot!(x, ya*ones(Nx, 1), fill_between=yb*ones(Nx, 1), fillalpha=0.1, color=:blue, label="", lw=0) plot!(zeros(2, 2), [ya ya; yb yb], lw=3, color=:blue, label=[L"range of$f$" ""]) annotate!(0.04, -0.3, L"$0$", ylims=(-0.6, 3.2)) vline!([0], color=:black, label="") hline!([0], color=:black, label="") plot!(foreground_color_axis=:white, foreground_color_text=:white, foreground_color_border=:white) ybar = 2.6 plot!(x, x .* 0 .+ ybar, color=:black, linestyle=:dash, legend=:none) annotate!(0.04, 0.91 * ybar, L"$y$") plot(p1, p2, layout=(2, 1), size=(600, 700)) In the first plot there are multiple solutions, as the function is not one-to-one, while in the second there are no solutions, since $$y$$ lies outside the range of $$f$$ Can we impose conditions on $$A$$ in (3) that rule out these problems? In this context, the most important thing to recognize about the expression $$Ax$$ is that it corresponds to a linear combination of the columns of $$A$$ In particular, if $$a_1, \ldots, a_k$$ are the columns of $$A$$, then $Ax = x_1 a_1 + \cdots + x_k a_k$ Hence the range of $$f(x) = Ax$$ is exactly the span of the columns of $$A$$ We want the range to be large, so that it contains arbitrary $$y$$ As you might recall, the condition that we want for the span to be large is linear independence A happy fact is that linear independence of the columns of $$A$$ also gives us uniqueness Indeed, it follows from our earlier discussion that if $$\{a_1, \ldots, a_k\}$$ are linearly independent and $$y = Ax = x_1 a_1 + \cdots + x_k a_k$$, then no $$z \not= x$$ satisfies $$y = Az$$ ### The $$n \times n$$ Case¶ Let’s discuss some more details, starting with the case where $$A$$ is $$n \times n$$ This is the familiar case where the number of unknowns equals the number of equations For arbitrary $$y \in \mathbb R ^n$$, we hope to find a unique $$x \in \mathbb R ^n$$ such that $$y = Ax$$ In view of the observations immediately above, if the columns of $$A$$ are linearly independent, then their span, and hence the range of $$f(x) = Ax$$, is all of $$\mathbb R ^n$$ Hence there always exists an $$x$$ such that $$y = Ax$$ Moreover, the solution is unique In particular, the following are equivalent 1. The columns of $$A$$ are linearly independent 2. For any $$y \in \mathbb R ^n$$, the equation $$y = Ax$$ has a unique solution The property of having linearly independent columns is sometimes expressed as having full column rank #### Inverse Matrices¶ Can we give some sort of expression for the solution? If $$y$$ and $$A$$ are scalar with $$A \not= 0$$, then the solution is $$x = A^{-1} y$$ A similar expression is available in the matrix case In particular, if square matrix $$A$$ has full column rank, then it possesses a multiplicative inverse matrix $$A^{-1}$$, with the property that $$A A^{-1} = A^{-1} A = I$$ As a consequence, if we pre-multiply both sides of $$y = Ax$$ by $$A^{-1}$$, we get $$x = A^{-1} y$$ This is the solution that we’re looking for #### Determinants¶ Another quick comment about square matrices is that to every such matrix we assign a unique number called the determinant of the matrix — you can find the expression for it here If the determinant of $$A$$ is not zero, then we say that $$A$$ is nonsingular Perhaps the most important fact about determinants is that $$A$$ is nonsingular if and only if $$A$$ is of full column rank This gives us a useful one-number summary of whether or not a square matrix can be inverted ### More Rows than Columns¶ This is the $$n \times k$$ case with $$n > k$$ This case is very important in many settings, not least in the setting of linear regression (where $$n$$ is the number of observations, and $$k$$ is the number of explanatory variables) Given arbitrary $$y \in \mathbb R ^n$$, we seek an $$x \in \mathbb R ^k$$ such that $$y = Ax$$ In this setting, existence of a solution is highly unlikely Without much loss of generality, let’s go over the intuition focusing on the case where the columns of $$A$$ are linearly independent It follows that the span of the columns of $$A$$ is a $$k$$-dimensional subspace of $$\mathbb R ^n$$ This span is very “unlikely” to contain arbitrary $$y \in \mathbb R ^n$$ To see why, recall the figure above, where $$k=2$$ and $$n=3$$ Imagine an arbitrarily chosen $$y \in \mathbb R ^3$$, located somewhere in that three dimensional space What’s the likelihood that $$y$$ lies in the span of $$\{a_1, a_2\}$$ (i.e., the two dimensional plane through these points)? In a sense it must be very small, since this plane has zero “thickness” As a result, in the $$n > k$$ case we usually give up on existence However, we can still seek a best approximation, for example an $$x$$ that makes the distance $$\| y - Ax\|$$ as small as possible To solve this problem, one can use either calculus or the theory of orthogonal projections The solution is known to be $$\hat x = (A'A)^{-1}A'y$$ — see for example chapter 3 of these notes ### More Columns than Rows¶ This is the $$n \times k$$ case with $$n < k$$, so there are fewer equations than unknowns In this case there are either no solutions or infinitely many — in other words, uniqueness never holds For example, consider the case where $$k=3$$ and $$n=2$$ Thus, the columns of $$A$$ consists of 3 vectors in $$\mathbb R ^2$$ This set can never be linearly independent, since it is possible to find two vectors that span $$\mathbb R ^2$$ (For example, use the canonical basis vectors) It follows that one column is a linear combination of the other two For example, let’s say that $$a_1 = \alpha a_2 + \beta a_3$$ Then if $$y = Ax = x_1 a_1 + x_2 a_2 + x_3 a_3$$, we can also write $y = x_1 (\alpha a_2 + \beta a_3) + x_2 a_2 + x_3 a_3 = (x_1 \alpha + x_2) a_2 + (x_1 \beta + x_3) a_3$ In other words, uniqueness fails ### Linear Equations with Julia¶ Here’s an illustration of how to solve linear equations with Julia’s built-in linear algebra facilities A = [1.0 2.0; 3.0 4.0]; y = ones(2, 1); # A column vector 2×1 Array{Float64,2}: 1.0 1.0 det(A) -2.0 A_inv = inv(A) 2×2 Array{Float64,2}: -2.0 1.0 1.5 -0.5 x = A_inv * y # solution 2×1 Array{Float64,2}: -1.0 1.0 A * x # should equal y (a vector of ones) 2×1 Array{Float64,2}: 1.0 1.0 A\y # produces the same solution 2×1 Array{Float64,2}: -1.0 1.0 Observe how we can solve for $$x = A^{-1} y$$ by either via inv(A) * y, or using A \ y The latter method is preferred because it automatically selects the best algorithm for the problem based on the values of A and y If A is not square then A \ y returns the least squares solution $$\hat x = (A'A)^{-1}A'y$$ ## Eigenvalues and Eigenvectors¶ Let $$A$$ be an $$n \times n$$ square matrix If $$\lambda$$ is scalar and $$v$$ is a non-zero vector in $$\mathbb R ^n$$ such that $A v = \lambda v$ then we say that $$\lambda$$ is an eigenvalue of $$A$$, and $$v$$ is an eigenvector Thus, an eigenvector of $$A$$ is a vector such that when the map $$f(x) = Ax$$ is applied, $$v$$ is merely scaled The next figure shows two eigenvectors (blue arrows) and their images under $$A$$ (red arrows) As expected, the image $$Av$$ of each $$v$$ is just a scaled version of the original A = [1 2 2 1] evals, evecs = eig(A) a1, a2 = evals[1], evals[2] evecs = evecs[:, 1], evecs[:, 2] eig_1 = zeros(2, length(evecs)) eig_2 = zeros(2, length(evecs)) labels = [] for i = 1:length(evecs) v = evecs[i] eig_1[2, i] = v[1] eig_2[2, i] = v[2] end x = linspace(-5, 5, 10) y = -linspace(-5, 5, 10) plot(eig_1[:, 2], a1 * eig_2[:, 2], arrow=true, color=:red, legend=:none, xlims=(-3, 3), ylims=(-3, 3), annotations=labels, xticks=-5:1:5, yticks=-5:1:5, framestyle=:origin) plot!(a2 * eig_1[:, 2], a2 * eig_2, arrow=true, color=:red) plot!(eig_1, eig_2, arrow=true, color=:blue) plot!(x, y, color=:blue, lw=0.4, alpha=0.6) plot!(x, x, color=:blue, lw=0.4, alpha=0.6) The eigenvalue equation is equivalent to $$(A - \lambda I) v = 0$$, and this has a nonzero solution $$v$$ only when the columns of $$A - \lambda I$$ are linearly dependent This in turn is equivalent to stating that the determinant is zero Hence to find all eigenvalues, we can look for $$\lambda$$ such that the determinant of $$A - \lambda I$$ is zero This problem can be expressed as one of solving for the roots of a polynomial in $$\lambda$$ of degree $$n$$ This in turn implies the existence of $$n$$ solutions in the complex plane, although some might be repeated Some nice facts about the eigenvalues of a square matrix $$A$$ are as follows 1. The determinant of $$A$$ equals the product of the eigenvalues 2. The trace of $$A$$ (the sum of the elements on the principal diagonal) equals the sum of the eigenvalues 3. If $$A$$ is symmetric, then all of its eigenvalues are real 4. If $$A$$ is invertible and $$\lambda_1, \ldots, \lambda_n$$ are its eigenvalues, then the eigenvalues of $$A^{-1}$$ are $$1/\lambda_1, \ldots, 1/\lambda_n$$ A corollary of the first statement is that a matrix is invertible if and only if all its eigenvalues are nonzero Using Julia, we can solve for the eigenvalues and eigenvectors of a matrix as follows A = [1.0 2.0; 2.0 1.0]; evals, evecs = eig(A); evals 2-element Array{Float64,1}: -1.0 3.0 evecs 2×2 Array{Float64,2}: -0.707107 0.707107 0.707107 0.707107 Note that the columns of evecs are the eigenvectors Since any scalar multiple of an eigenvector is an eigenvector with the same eigenvalue (check it), the eig routine normalizes the length of each eigenvector to one ### Generalized Eigenvalues¶ It is sometimes useful to consider the generalized eigenvalue problem, which, for given matrices $$A$$ and $$B$$, seeks generalized eigenvalues $$\lambda$$ and eigenvectors $$v$$ such that $A v = \lambda B v$ This can be solved in Julia via eig(A, B) Of course, if $$B$$ is square and invertible, then we can treat the generalized eigenvalue problem as an ordinary eigenvalue problem $$B^{-1} A v = \lambda v$$, but this is not always the case ## Further Topics¶ We round out our discussion by briefly mentioning several other important topics ### Series Expansions¶ Recall the usual summation formula for a geometric progression, which states that if $$|a| < 1$$, then $$\sum_{k=0}^{\infty} a^k = (1 - a)^{-1}$$ A generalization of this idea exists in the matrix setting #### Matrix Norms¶ Let $$A$$ be a square matrix, and let $\| A \| := \max_{\| x \| = 1} \| A x \|$ The norms on the right-hand side are ordinary vector norms, while the norm on the left-hand side is a matrix norm — in this case, the so-called spectral norm For example, for a square matrix $$S$$, the condition $$\| S \| < 1$$ means that $$S$$ is contractive, in the sense that it pulls all vectors towards the origin [1] #### Neumann’s Theorem¶ Let $$A$$ be a square matrix and let $$A^k := A A^{k-1}$$ with $$A^1 := A$$ In other words, $$A^k$$ is the $$k$$-th power of $$A$$ Neumann’s theorem states the following: If $$\| A^k \| < 1$$ for some $$k \in \mathbb{N}$$, then $$I - A$$ is invertible, and (4)$(I - A)^{-1} = \sum_{k=0}^{\infty} A^k$ #### Spectral Radius¶ A result known as Gelfand’s formula tells us that, for any square matrix $$A$$, $\rho(A) = \lim_{k \to \infty} \| A^k \|^{1/k}$ Here $$\rho(A)$$ is the spectral radius, defined as $$\max_i |\lambda_i|$$, where $$\{\lambda_i\}_i$$ is the set of eigenvalues of $$A$$ As a consequence of Gelfand’s formula, if all eigenvalues are strictly less than one in modulus, there exists a $$k$$ with $$\| A^k \| < 1$$ In which case (4) is valid ### Positive Definite Matrices¶ Let $$A$$ be a symmetric $$n \times n$$ matrix We say that $$A$$ is 1. positive definite if $$x' A x > 0$$ for every $$x \in \mathbb R ^n \setminus \{0\}$$ 2. positive semi-definite or nonnegative definite if $$x' A x \geq 0$$ for every $$x \in \mathbb R ^n$$ Analogous definitions exist for negative definite and negative semi-definite matrices It is notable that if $$A$$ is positive definite, then all of its eigenvalues are strictly positive, and hence $$A$$ is invertible (with positive definite inverse) ### Differentiating Linear and Quadratic forms¶ The following formulas are useful in many economic contexts. Let • $$z, x$$ and $$a$$ all be $$n \times 1$$ vectors • $$A$$ be an $$n \times n$$ matrix • $$B$$ be an $$m \times n$$ matrix and $$y$$ be an $$m \times 1$$ vector Then 1. $$\frac{\partial a' x}{\partial x} = a$$ 2. $$\frac{\partial A x}{\partial x} = A'$$ 3. $$\frac{\partial x'A x}{\partial x} = (A + A') x$$ 4. $$\frac{\partial y'B z}{\partial y} = B z$$ 5. $$\frac{\partial y'B z}{\partial B} = y z'$$ Exercise 1 below asks you to apply these formulas ### Further Reading¶ The documentation of the linear algebra features built into Julia can be found here Chapters 2 and 3 of the Econometric Theory contains a discussion of linear algebra along the same lines as above, with solved exercises If you don’t mind a slightly abstract approach, a nice intermediate-level text on linear algebra is [Janich94] ## Exercises¶ ### Exercise 1¶ Let $$x$$ be a given $$n \times 1$$ vector and consider the problem $v(x) = \max_{y,u} \left\{ - y'P y - u' Q u \right\}$ subject to the linear constraint $y = A x + B u$ Here • $$P$$ is an $$n \times n$$ matrix and $$Q$$ is an $$m \times m$$ matrix • $$A$$ is an $$n \times n$$ matrix and $$B$$ is an $$n \times m$$ matrix • both $$P$$ and $$Q$$ are symmetric and positive semidefinite (What must the dimensions of $$y$$ and $$u$$ be to make this a well-posed problem?) One way to solve the problem is to form the Lagrangian $\mathcal L = - y' P y - u' Q u + \lambda' \left[A x + B u - y\right]$ where $$\lambda$$ is an $$n \times 1$$ vector of Lagrange multipliers Try applying the formulas given above for differentiating quadratic and linear forms to obtain the first-order conditions for maximizing $$\mathcal L$$ with respect to $$y, u$$ and minimizing it with respect to $$\lambda$$ Show that these conditions imply that 1. $$\lambda = - 2 P y$$ 2. The optimizing choice of $$u$$ satisfies $$u = - (Q + B' P B)^{-1} B' P A x$$ 3. The function $$v$$ satisfies $$v(x) = - x' \tilde P x$$ where $$\tilde P = A' P A - A'P B (Q + B'P B)^{-1} B' P A$$ As we will see, in economic contexts Lagrange multipliers often are shadow prices Note If we don’t care about the Lagrange multipliers, we can substitute the constraint into the objective function, and then just maximize $$-(Ax + Bu)'P (Ax + Bu) - u' Q u$$ with respect to $$u$$. You can verify that this leads to the same maximizer. ## Solutions¶ Thanks to Willem Hekman and Guanlong Ren for providing this solution. ### Exercise 1¶ We have an optimization problem: $v(x) = \max_{y,u} \{ -y'Py - u'Qu \}$ s.t. $y = Ax + Bu$ with primitives • $$P$$ be a symmetric and positive semidefinite $$n \times n$$ matrix. • $$Q$$ be a symmetric and positive semidefinite $$m \times m$$ matrix. • $$A$$ an $$n \times n$$ matrix. • $$B$$ an $$n \times m$$ matrix. The associated Lagrangian is : $L = -y'Py - u'Qu + \lambda' \lbrack Ax + Bu - y \rbrack$ #### 1.¶ Differentiating Lagrangian equation w.r.t y and setting its derivative equal to zero yields $\frac{ \partial L}{\partial y} = - (P + P') y - \lambda = - 2 P y - \lambda = 0 \:,$ since P is symmetric. Accordingly, the first-order condition for maximizing L w.r.t. y implies $\lambda = -2 Py \:.$ #### 2.¶ Differentiating Lagrangian equation w.r.t. u and setting its derivative equal to zero yields $\frac{ \partial L}{\partial u} = - (Q + Q') u - B'\lambda = - 2Qu + B'\lambda = 0 \:.$ Substituting $$\lambda = -2 P y$$ gives $Qu + B'Py = 0 \:.$ Substituting the linear constraint $$y = Ax + Bu$$ into above equation gives $Qu + B'P(Ax + Bu) = 0$ $(Q + B'PB)u + B'PAx = 0$ which is the first-order condition for maximizing L w.r.t. u. Thus, the optimal choice of u must satisfy $u = -(Q + B'PB)^{-1}B'PAx \:,$ which follows from the definition of the first-oder conditions for Lagrangian equation. #### 3.¶ Rewriting our problem by substituting the constraint into the objective function, we get $v(x) = \max_{u} \{ -(Ax+ Bu)'P(Ax+Bu) - u'Qu \} \:.$ Since we know the optimal choice of u satisfies$ u = -(Q + B’PB)^{-1}B’PAx , then $v(x) = -(Ax+ B u)'P(Ax+B u) - u'Q u \,\,\,\, with \,\,\,\, u = -(Q + B'PB)^{-1}B'PAx$ To evaluate the function \begin{align} v(x) &= -(Ax+ B u)'P(Ax+Bu) - u'Q u \\ &= -(x'A' + u'B')P(Ax+Bu) - u'Q u \\ &= - x'A'PAx - u'B'PAx - x'A'PBu - u'B'PBu - u'Qu \\ &= - x'A'PAx - 2u'B'PAx - u'(Q + B'PB) u \end{align} For simplicity, denote by $$S := (Q + B'PB)^{-1} B'PA$$, then u = -Sx\$.

Regarding the second term $$- 2u'B'PAx$$,

\begin{align} - 2u'B'PAx &= -2 x'S'B'PAx \\ & = 2 x'A'PB( Q + B'PB)^{-1} B'PAx \end{align}

Notice that the term $$(Q + B'PB)^{-1}$$ is symmetric as both P and Q are symmetric.

Regarding the third term $$- u'(Q + B'PB) u$$,

\begin{align} - u'(Q + B'PB) u &= - x'S' (Q + B'PB)Sx \\ &= -x'A'PB(Q + B'PB)^{-1}B'PAx \end{align}

Hence, the summation of second and third terms is $$x'A'PB(Q + B'PB)^{-1}B'PAx$$.

This implies that

\begin{align} v(x) &= - x'A'PAx - 2u'B'PAx - u'(Q + B'PB) u\\ &= - x'A'PAx + x'A'PB(Q + B'PB)^{-1}B'PAx \\ &= -x'[A'PA - A'PB(Q + B'PB)^{-1}B'PA] x \end{align}

Therefore, the solution to the optimization problem $$v(x) = -x' \tilde{P}x$$ follows the above result by denoting $$\tilde{P} := A'PA - A'PB(Q + B'PB)^{-1}B'PA$$.

Footnotes

 [1] Suppose that $$\|S \| < 1$$. Take any nonzero vector $$x$$, and let $$r := \|x\|$$. We have $$\| Sx \| = r \| S (x/r) \| \leq r \| S \| < r = \| x\|$$. Hence every point is pulled towards the origin.
• Share page


Math

A bag contains only red and blue marbles. Yasmine takes one marble at random from the bag. The probability that she takes a red marble is 1 in 5. Yasmine returns the marble to the bag and adds ﬁve more red marbles to the bag. The probability that she takes one red marble at random is now 1 in 3. How many red marbles were originally in the bag?

A. 3 red
B. 5 red
C. 10 red
D. 2 red

1. 👍
2. 👎
3. 👁
1. Oops i forgot to put i though B was the right answer ( B. 5 red

1. 👍
2. 👎
2. thought ^^

1. 👍
2. 👎
3. r/(r+b) = 1/5
(r+5)/(r+5+b) = 1/3

r=5

you are correct

1. 👍
2. 👎

Similar Questions

1. Probability

jeff has 8 red marbles, 6 blue marbles, and 4 green marbles that are the same size and shape. he puts the marbles into a bag, mixes the marbles, and randomly picks one marble. what is the probability that the marble will be blue?

2. math

A bag contains 8 red marbles, 5 blue marbles, 8 yellow marbles, and 6 green marbles. What is the probability of choosing a red marble if a single choice is made from the bag? is it 8/27 ?

3. Math liberal Arts

A bag contains 5 red marbles, 4 blue marbles, and 1 green marble. If a marble is selected at random, what is the probability that it is not blue?

4. Math

A bag contains 3 red marbles, 5 yellow marbles, and 4 blue marbles. One marble is chosen at random. What is the probability that the chosen marble will be blue? A) 1/12 B) 1/4 C) 1/3 D) 3/4 I think it is B. 1/4

1. math

A bag contains five red marbles and five blue marbles. You randomly pick a marble and then return it to the bag before picking another marble. The first marble is red and the second marble is blue. a. 1/4 = 0.25 ***** b. 21/55 =

2. Math :)

In a bag of 10 marbles, there are 5 blue marbles, 3 red marbles, and 2 white marbles. Complete the probability distribution table for drawing 1 marble out of the bag. Draw a: Probability Blue marble 5/10 Red marble 3/10 White

3. Math

A bag with 12 marbles has 3 yellow marbles, 4 blue marbles, and 5 red marbles. A marble is chosen from the bag at random. What is the probability that it is yellow?

A bag contains 7 red marbles, 2 blue marbles, and 1 green marble. If a marble is selected at random, what is the probability of choosing a marble that is not blue? 7 red marbles plus 1 green marble = 8/10 = answer = 4/5

1. Math

A bag of marbles contains 5 red, 3 blue, 2 green, and 2 yellow marbles. What is the probability that you choose a blue marble and then another blue marble, assuming you replace the first marble?

2. Math

Tom keeps all of his favorite marbles in a special leather bag. Right now, five red marbles, four blue marbles, and yellow marbles are in the bag. If he randomly chooses one marble to give to a friend what is the probability that

3. algebra

A bag contains 9 marbles: 2 are green, 4 are red, and 3 are blue. Laura chooses a marble at random, and without putting it back, chooses another one at random. What is the probability that both marbles she chooses are blue? Write

4. Math

One bag contains 5 red marbles, 4 blue marbles, and 3 yellow marbles, and a second bag contains 4 red marbles, 6 blue marbles, and 5 yellow marbles. If Lydia randomly draws one marble from each bag, what is the probability that