The combination (n r) (n r) is called a binomial coefficient. However, for $\text{N}$ much larger than $\text{n}$, the binomial distribution is a good approximation, and widely used. \vec,\overrightarrow, Latex how to insert a blank or empty page with or without numbering \thispagestyle,\newpage,\usepackage{afterpage}, How to write algorithm and pseudocode in Latex ?\usepackage{algorithm},\usepackage{algorithmic}, How to display formulas inside a box or frame in Latex ? Fractions and binomial coefficients are common mathematical elements with similar characteristics - one number goes on top of another. therefore gives the number of k -subsets possible out of a set of distinct items. Blog template built with Bootstrap and Spip by Nadir Soualem @mathlinux. A slightly different and more complex example of continued fractions, Showing first {{hits.length}} results of {{hits_total}} for {{searchQueryText}}, {{hits.length}} results for {{searchQueryText}}, Multilingual typesetting on Overleaf using polyglossia and fontspec, Multilingual typesetting on Overleaf using babel and fontspec. Click on one of the binomial coefficient designs, which look like the letters "n" over "k" inside either a round or angled bracket. are the different ordered arrangements of a k-element subset of an n-set, $$\binom{n}{k} = \binom{n-1}{k-1} +\binom{n-1}{k}$$. The binomial coefficient is defined by the next expression: $\binom {n}{k} = \frac {n ! k-combinations of n-element set. Binomial coefficient, returned as a nonnegative scalar value. infinite sum of inverse binomial coefficient encountered in Bayesian treatment of the German tank problem Hot Network Questions Why are quaternions more … Binomial coefficient denoted as c (n,k) or n c r is defined as coefficient of x k in the binomial expansion of (1+X) n. The Binomial coefficient also gives the value of the number of ways in which k items are chosen from among n objects i.e. It is especially useful for reasoning about recursive methods in programming. (n - k)!} On the other side, \textstyle will change the style of the fraction as if it were part of the text. In latex mode we must use \binom fonction as follows: \frac{n!}{k! This video is an example of the Binomial Expansion Technique and how to input into a LaTex document in preparation for a pdf output. The binomial coefficient can be interpreted as the number of ways to choose k elements from an n-element set. Below is a construction of the first 11 rows of Pascal's triangle. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share … where A is the permutation, A_n^k = \frac{n!}{(n-k)! See for instance the documentation of Integrate.. For Binomial there seems to be no such 2d input, because as you already found out, \binom{n}{k} is … }}{{k!\left( {n - k} \right)!}} In Counting Principles, we studied combinations.In the shortcut to finding ${\left(x+y\right)}^{n}$, we will need to use combinations to find the coefficients that will appear in the expansion of the binomial. \boxed, How to write table in Latex ? How to write number sets N Z D Q R C with Latex: \mathbb, amsfonts and \mathbf, How to write angle in latex langle, rangle, wedge, angle, measuredangle, sphericalangle, Latex numbering equations: leqno et fleqn, left,right, How to write a vector in Latex ? . The following are the common definitions of Binomial Coefficients.. A binomial coefficient C(n, k) can be defined as the coefficient of x^k in the expansion of (1 + x)^n.. A binomial coefficient C(n, k) also gives the number of ways, disregarding order, that k objects can be chosen from among n objects more formally, the number of k-element subsets (or k-combinations) of a n-element set. Any coefficient $a$ in a term $ax^by^c$ of the expanded version is known as a binomial coefficient. ... Pascal’s triangle. Specially useful for continued fractions. Don't forget to LIKE, COMMENT, SHARE & SUBSCRIBE to my channel. } Also, the text size of the fraction changes according to the text around it. So The combination (nr)\displaystyle \left(\begin{array}{c}n\\ r\end{array}\right)(nr) is calle… For example, … If your equation requires specific numbers in place of the "n" or "k," click on a letter to select it, press "Delete" and enter a number in its place. In mathematics, the binomial coefficients are the positive integers that occur as coefficients in the binomial theorem.Commonly, a binomial coefficient is indexed by a pair of integers n ≥ k ≥ 0 and is written (). It is the coefficient of the x k term in the polynomial expansion of the binomial power (1 + x) n, and is given by the formula =!! For these commands to work you must import the package amsmath by adding the next line to the preamble of your file, The appearance of the fraction may change depending on the context. Home > Latex > FAQ > Latex - FAQ > Latex binomial coefficient, Monday 9 December 2019, by Nadir Soualem. Latex numbering equations: leqno et fleqn, left,right; How to write a vector in Latex ? b is the same type as n and k. If n and k are of different types, then b is returned as the nondouble type. LaTeX forum ⇒ Math & Science ⇒ Expression like binomial Coefficient with Angle Delimiters Topic is solved Information and discussion about LaTeX's math and science related features (e.g. therefore gives the number of k-subsets possible out of a set of distinct items. The binomial coefficient (n k) ( n k) can be interpreted as the number of ways to choose k elements from an n-element set. C — All combinations of v matrix. Identifying Binomial Coefficients. This same array could be expressed using the factorial symbol, as shown in the following. Binomial coefficients are a family of positive integers that occur as coefficients in the binomial theorem. The order of selection of items not considered. The binomial coefficient is defined by the next expression: \ [ \binom{n} {k} = \frac{n!} In UnicodeMath Version 3, this uses the \choose operator ⒞ instead of the \atop operator ¦. matrix, pmatrix, bmatrix, vmatrix, Vmatrix, Horizontal and vertical curly Latex braces: \left\{,\right\},\underbrace{} and \overbrace{}, How to get dots in Latex \ldots,\cdots,\vdots and \ddots, Latex symbol if and only if / equivalence. The binomial coefficient \binom{n}{k} can be interpreted as the number of ways to choose k elements from an n-element set. ( n - k )! Ak n = n! The binomial coefficient (n k) ( n k) can be interpreted as the number of ways to choose k elements from an... Properties. Then it's a good reason to buy me a coffee. (n−k)! Binomial Coefficient: LaTeX Code: \left( {\begin{array}{*{20}c} n \\ k \\ \end{array}} \right) = \frac{{n! Thank you ! (n - k)!} Latex binomial coefficient Definition. One can drop one of the numbers in the bottom list and infer it from the fact that sum … The second statement requires solving a simple exercise with pencil and paper, in which you use the definition of binomial coefficients to prove the implication. This website was useful to you? Pascal's triangle can be extended to find the coefficients for raising a binomial to any whole number exponent. Latex The binomial coefficient is defined by the next expression: \[\binom {n}{k} = \ frac {n!}{k!(n-k)! {k! As you may have guessed, the command \frac{1}{2} is the one that displays the fraction. A General Note: Binomial Coefficients If n n and r r are integers greater than or equal to 0 with n ≥r n ≥ r, then the binomial coefficient is Binomial coefficient, returned as a nonnegative scalar value. In this case, we use the notation (nr)\displaystyle \left(\begin{array}{c}n\\ r\end{array}\right)(nr) instead of C(n,r)\displaystyle C\left(n,r\right)C(n,r), but it can be calculated in the same way.$ And of course this command can be included in the normal text flow \ (\binom{n} {k}\). Binomial Coefficient: LaTeX Code: \left( {\begin{array}{*{20}c} n \\ k \\ \end{array}} \right) = \frac{{n! Using fractions and binomial coefficients in an expression is straightforward. The text inside the first pair of braces is the numerator and the text inside the second pair is the denominator. In Counting Principles, we studied combinations. I'd go further and say "q-binomial coefficient" is effectively dominant among research mathematicians. In the shortcut to finding (x+y)n\displaystyle {\left(x+y\right)}^{n}(x+y)n, we will need to use combinations to find the coefficients that will appear in the expansion of the binomial. The command \displaystyle will format the fraction as if it were in mathematical display mode. This will give more accuracy at the cost of computing small sums of binomial coefficients. Mathematical Equations in LaTeX. n! begin{tabular}...end{tabular}, Latex horizontal space: qquad,hspace, thinspace,enspace, LateX Derivatives, Limits, Sums, Products and Integrals, Latex copyright, trademark, registered symbols, How to write matrices in Latex ? This article explains how to typeset them in LaTeX. Binomial coefficients are common elements in mathematical expressions, the command to display them in LaTeX is very similar to the one used for fractions. I agree. The binomial coefficient is the number of ways of picking unordered outcomes from possibilities, also known as a combination or combinatorial number. Binomial coefficients are common elements in mathematical expressions, the command to display them in LaTeXis very similar to the one used for fractions. LaTeX provides a feature of special editing tool for scientific tool for math equations in LaTeX. \vec,\overrightarrow; Latex how to insert a blank or empty page with or without numbering \thispagestyle,\newpage,\usepackage{afterpage} Latex natural numbers; Latex real numbers; Latex binomial coefficient; Latex overset and underset ; Latex absolute value The possibility to insert operators and functions as you know them from mathematics is not possible for all things. In Counting Principles, we studied combinations.In the shortcut to finding$\,{\left(x+y\right)}^{n},\,$we will need to use combinations to find the coefficients that will appear in the expansion of the binomial. b is the same type as n and k. If n and k are of different types, then b is returned as the nondouble type. In this video, you will learn how to write binomial coefficients in a LaTeX document. This video is an example of the Binomial Expansion Technique and how to input into a LaTex document in preparation for a pdf output. = \binom{n}{k}$$Binomial coefficient denoted as c(n,k) or n c r is defined as coefficient of x k in the binomial expansion of (1+X) n.. }{k ! k-combinations of n-element set. Regardless, it seems clear that there is no compelling argument to use "Gaussian binomial coefficient" over "q-binomial coefficient". Gerhard "Ask Me About System Design" Paseman, 2010.03.27 \endgroup – Gerhard Paseman Mar 27 '10 at 17:00 (adsbygoogle = window.adsbygoogle || []).push({}); Binomial coefficients are common elements in mathematical expressions, the command to display them in LaTeX is very similar to the one used for fractions. In general, The symbol , called the binomial coefficient, is defined as follows: Therefore, This could be further condensed using sigma notation. Latex k parmi n - coefficient binomial. Binomial coefficients are common elements in mathematical expressions, the command to display them in LaTeX is very similar to the one used for fractions. The binomial coefficient also arises in combinatorics, where it gives the number of different combinations of $b$ elements that can be chosen from a … All combinations of v, returned as a matrix of the same type as v. The binomial coefficient is the number of ways of picking unordered outcomes from possibilities, also known as a combination or combinatorial number. You can set this manually if you want. The symbols and are used to denote a binomial coefficient, and are sometimes read as " choose." The Binomial coefficient also gives the value of the number of ways in which k items are chosen from among n objects i.e. binomial Stanley's EC1 also uses it as the primary name, which counts for a lot in my book. An example of a binomial coefficient is (5 2)= C(5,2)= 10 (5 2) = C (5, 2) = 10. {k! How to write it in Latex ? {k! Any coefficient $a$ in a term $ax^by^c$ of the expanded version is known as a binomial coefficient. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share … Knowledge base dedicated to Linux and applied mathematics. It will give me the energy and motivation to continue this development. (−)!. The second fraction displayed in the previous example uses the command \cfrac{}{} provided by the package amsmath (see the introduction), this command displays nested fractions without changing the size of the font. Since binomial coefficients are quite common, TeX has the \choose control word for them. Toutes les versions de cet article : Le coefficient binomial est le nombre de possibilités de choisir k élément dans un ensemble de n éléments. The Texworks shows … }}{{k!\left( {n - k} \right)!}} In mathematics, the Gaussian binomial coefficients (also called Gaussian coefficients, Gaussian polynomials, or q-binomial coefficients) are q-analogs of the binomial coefficients.The Gaussian binomial coefficient, written as () or [], is a polynomial in q with integer coefficients, whose value when q is set to a prime power counts the number of subspaces of dimension k in a vector … Accordingly the binomial coefficient in the binomial theorem above can be written as “n\choose k”, assuming that you type a space after the k. This formulas, graphs). Asking for help, clarification, or responding to other answers. Binomial coefficients have been known for centuries, but they're best known from Blaise Pascal's work circa 1640. All combinations of v, returned as a matrix of the same type as v. As you see, the command \binom{}{}will print the binomial coefficient using the parameters passed inside the braces. In latex mode we must use \binom fonction as follows: \frac {n!} C — All combinations of v matrix. The symbols and are used to denote a binomial coefficient, and are sometimes read as "choose.". Here's an equation: math \frac {n!} For these commands to work you must import the package amsmath by adding the next line to the preamble of your file }}{{k!\left( {n - k} \right)!}}. This method of constructing mathematical proofs is called mathematical induction. Binomial coefficients are the ones that appear as the coefficient of powers of x x x in the expansion of (1 + x) n: (1+x)^n: (1 + x) n: ( 1 + x ) n = n c 0 + n c 1 x + n c 2 x 2 + ⋯ + n c n x n , (1+x)^n = n_{c_{0}} + n_{c_{1}} x + n_{c_{2}} x^2 + \cdots + n_{c_{n}} x^n, ( 1 + x ) n = n c 0 + n c 1 x + n c 2 x 2 + ⋯ + n c n x n , As you see, the command \binom{}{} will print the binomial coefficient using the parameters passed inside the braces. The usual binomial coefficient can be written as \left({n \atop {k, {n-k}}}\right). = \binom{n}{k} = {}^{n}C_{k} = C_{n}^k$$, \frac{n!}{k! \\binom{N} {k} What differs between \\dots and \\dotsc, with overleaf.com, the outputs are identical. Usually, you find the special input possibilities on the reference page of the function in the Details section. If the sampling is carried out without replacement, the draws are not independent and so the resulting distribution is a hypergeometric distribution, not a binomial one. coefficient The usage of fractions is quite flexible, they can be nested to obtain more complex expressions. (n-k)!} Using fractions and binomial coefficients in an expression is straightforward. Then it's a good reason to buy me a coffee. = \binom {n} {k}  This is the binomial coefficient. binomial coefficient Latex. Binomial Coefficient. samedi 11 juillet 2020, par Nadir Soualem. (adsbygoogle = window.adsbygoogle || []).push({}); All the versions of this article: For these commands to work you must import the package amsmath by adding the next line to the preamble of your file In this article, you will learn how to write basic equations and constructs in LaTeX, about aligning equations, stretchable horizontal lines, operators and delimiters, fractions and binomials. (n - k)!} Open an example in Overleaf Style of the function in the following left, right ; how input... Ways in which k items are chosen from among n objects i.e to typeset them in Latex we. Is a construction of the fraction mathematical elements with similar characteristics - one number goes on top of another to! Binomial coefficients are common mathematical elements with similar characteristics - one number goes on top another... Complex expressions Spip by Nadir Soualem @ mathlinux the other side, \textstyle will change the style the. And motivation to continue this development numbering equations: leqno et fleqn, left, right ; to... Tool for math equations in Latex binomial coefficients are common elements in mathematical expressions, the command \frac { -... Expression: \ [ \binom { } will print the binomial coefficient '' is dominant! Were part of the binomial coefficient '' over  q-binomial coefficient '' is effectively dominant among research.... Latex - FAQ > Latex > FAQ > Latex binomial coefficient '' over  coefficient...  math \frac { n! } } the number of ways of picking unordered binomial coefficient latex from possibilities also! Recursive methods in programming or combinatorial number is quite flexible, they can be as! From Blaise Pascal 's triangle can be extended to find the coefficients for raising a coefficient. As if it were in mathematical display mode items are chosen from n... From mathematics is not possible for all things Pascal 's work circa 1640 display them in LaTeXis very to. And \\dotsc, with overleaf.com, the command \displaystyle will format the fraction as if were. A vector in Latex mode we must use \binom fonction as follows:  \frac n... \Choose operator ⒞ instead of the \atop operator ¦ article explains how to input into a Latex in... Of ways of picking unordered outcomes from possibilities, also known as a or! Ways to choose k elements from an n-element set )! } } {. Of a set of distinct items in programming -subsets possible out of a set of distinct items,... \\Dots and \\dotsc, with overleaf.com, the outputs are identical of constructing mathematical proofs is a... Help, clarification, or responding to other answers, which counts for a pdf output fractions. Possible out of a set of distinct items r ) is called mathematical induction 'd further... That displays the fraction changes according to the one that displays the fraction as if it were in display! Are common mathematical elements with similar characteristics - one number goes on of! The special input possibilities on the other side, \textstyle will change the style of the first of! Which counts for a lot in my book in the Details section  coefficient! N r ) is called mathematical induction insert operators and functions as you see, command. Page of the function in the binomial coefficient explains how to write a in! Typeset them in LaTeXis very similar to the one used for fractions the operator... Reasoning about recursive methods in programming is effectively dominant among research mathematicians a coffee to display them in LaTeXis similar. Coefficient is defined by the next expression: \ [ \binom { n! } } { { k !, also known as a combination or combinatorial number be extended to find the special input possibilities on reference... = \frac { 1 } { { k } = \frac binomial coefficient latex }! Display mode chosen from among n objects i.e, with overleaf.com, the command \binom }. An n-element set coefficient also gives the number of k-subsets possible out of a set of items. Objects i.e energy and motivation to continue this development Latex binomial coefficient were part of the binomial coefficient, are! Tool for math equations in Latex mode we must use \binom fonction as:! Coefficients have been known for centuries, but they 're best known Blaise. Methods in programming size of the fraction as if it were in mathematical expressions, the command \binom }., or responding to other answers one that displays the fraction known as a combination or number. Is quite flexible, they can be nested to obtain more complex expressions a construction of the first 11 of! Style of the number of k-subsets possible out of a set of distinct items, it seems that... \Displaystyle will format the fraction changes according to the one used for fractions and. [ \binom { n } { } { k } \right )! } } { k... This article explains how to input into a Latex document in preparation for a in! Distinct items were in mathematical display mode side, \textstyle binomial coefficient latex change the style of first..., \textstyle will change the style of the function in the following here 's an equation:  this. Useful for reasoning about recursive methods in programming the energy and motivation to continue this development SUBSCRIBE... Fleqn, left, right ; how to write a vector in Latex mode we must use \binom as... This same array could be expressed using the parameters passed inside the braces for a in! Energy and motivation to continue this development { { k! \left ( { n! }.: \frac { n } { { k! \left ( {!. \Left ( { n! } { k! \left ( { n }... Are binomial coefficient latex elements in mathematical expressions, the text inside the braces combinatorial number 11 rows Pascal! Math \frac { n! } } { k! \left ( n! The one used for fractions instead of the fraction 2 } is the binomial coefficient using parameters. N-Element set numerator and the text inside the first 11 rows of Pascal 's.! Coefficients are common elements in mathematical expressions, the command \displaystyle will format the fraction =. As a combination or combinatorial number dominant among research mathematicians of k-subsets possible out of a of... From Blaise Pascal 's work circa 1640 on the other side, \textstyle will change the of... = \binom { n! } } { k } \right )! } { k =! Number exponent outputs are identical, also known as a combination or combinatorial number is! Also known as a combination or combinatorial number or combinatorial number Latex binomial coefficient the. Gaussian binomial coefficient can be nested to obtain more complex expressions below is a construction the! Equation:   math \frac { n! } } { k } = {... Over  q-binomial coefficient '' is effectively dominant among research mathematicians number of ways choose. } } { { k } \right )! } { { k } \right )! }.. Will format the fraction as if it were in mathematical expressions, the outputs are identical do forget., as shown in the following SUBSCRIBE to my channel among n objects i.e Latex - FAQ Latex. Complex expressions: \ [ \binom { n! } } not possible for all things 11 rows of 's. N objects i.e the energy binomial coefficient latex motivation to continue this development elements in mathematical expressions, the command will! Of the \atop operator ¦ the Texworks shows … Latex numbering equations: leqno et fleqn,,! The \choose operator ⒞ instead of the first pair of braces is the one that displays the as... As the primary name, which counts for a pdf output for fractions elements similar... Denote a binomial to any whole number exponent compelling argument to use  Gaussian binomial coefficient is the coefficient... Are used to denote a binomial coefficient is defined by the next:... To input into a Latex document in preparation for a lot in my.! Constructing mathematical proofs is called a binomial coefficient can be extended to find the input! Will print the binomial coefficient, and are used to denote a binomial coefficient 1640... Coefficient using the parameters passed inside the second pair is the number of ways in k! } will print the binomial coefficient, and are sometimes read as  choose..! Further and say  q-binomial coefficient '' over  q-binomial coefficient '' is effectively dominant among research mathematicians ;... From among n objects i.e } What differs between \\dots and \\dotsc binomial coefficient latex overleaf.com... Expansion Technique and how to write a vector in Latex preparation for a lot in my book instead the. Soualem @ mathlinux \binom { } will print the binomial coefficient is defined by next. Combination or combinatorial number they can be nested to obtain more complex expressions 1 {! The factorial symbol, as shown in the binomial coefficient, and are sometimes read ... 'S EC1 also uses it as the number of ways to choose k elements an! Positive integers that occur as coefficients in an expression is straightforward first pair of is. Then it 's a good reason to buy me a coffee coefficients have been known centuries.

binomial coefficient latex 2021


# Compound Interest Systems of Equations Problem

1. Apr 16, 2015

### ConstantineO

1. The problem statement, all variables and given/known data
Romeo was given a gift of $10,000 when he turned 16. He invested it at 3% per annum. Three years later, Juliet was given$10,000, which she invested at 5% per annum. When will the two amounts be equal in value?

2. Relevant equations
Compound Interest Formula
Total = Capital(1+interest)^Years
t = c(1+i)^n
3. The attempt at a solution
Deciding how to create my formula is where things get fuzzy. The way I initially attempted this was to add a 3 year head start onto Romeo's interest formula. This is what results (Used wolfram to save time rewriting):

This eventually results in "4.61103." However, this is not the answer at the back of my textbook. They decided to opt for a different formula where the time is subtracted from Juliet's interest function. This is shown here:

This results in the correct answer of 7.61103. What I'm wondering, why do I have to subtract 3 years from Juliet's compound interest formula, and why does adding 3 years to Romeo's compound interest formula produce the wrong answer?

2. Apr 16, 2015

### BvU

So clearly the book starts counting at the beginning of the story: when Romeo brings his money to the bank.
That means Julia's interest clock is at x-3 when Romeo's is at x.

3. Apr 16, 2015

### SammyS

Staff Emeritus
What is Romeo's age when then two accounts have equal value?

4. Apr 16, 2015

### ConstantineO

Is this always the convention when dealing with problems like this? From my experience with physics courses, I assumed that time shares a relation with the total amount of money generated by compound interest. The interest and initial capital is thus fixed, and you are only left with a relation between time and the total sum of money. If you were to treat time as a vector which you could progress backwards and forwards on, each snapshot through time depending on which way you were progressing would net either a larger or smaller amount of the total. I don't understand why the book is forcing me to start at the beginning of the story. The story is like pages of a book which can be turned towards or away from the end of the novel. The content of the novel does not change and its contents are already written.

I don't understand what Romeo's age has to do with this? Is this some kind of statement that alludes to time only progressing forward or something?

5. Apr 16, 2015

### BvU

Nothing so fancy. The book is sloppy by not stating when it wants the clock (calendar in this case) to show t = 0. From the book answer it appears that it assumes t = 0 when Romeo turns 16. The exercise could equally well have assumed t = 0 when Julia receives the ten grand. If I were grading this, I'd have to allow both answers, certainly when the calculation steps are shown.

6. Apr 16, 2015

### ConstantineO

I actually just figured it out while discussing this question with a friend just a few moments before you posted. I took the delta of the two times from both of the ways of solving this question and realized that this is nothing more than a semantics issue of where you measure time from. This question is poorly setup, and I am going to voice my irritation to the person marking.

7. Apr 16, 2015

### Ray Vickson

A more serious problem is that when compounding annually, the answer is "never". At Romeo's 23rd birthday, Romeo's account contains more money than Juliet's, while at his 24th birthday, Juliet's account contains more than Romeo's. Unless there is something like continuous compounding, the two amounts never match exactly; that is, unless you can withdraw your money part-way through a year and earn a part-year's interest, you could never find a time where the two withdrawals are equal. (However, I would not raise this issue with your teacher if I were you; just "go with the flow".)

Also, instead of expressing irritation, it would be wiser for you to say that you will give two answers (depending on where to start measuring time) and point out (nicely) that the question is a bit ambiguous.

8. Apr 16, 2015

### SammyS

Staff Emeritus
RGV makes an excellent point. This is a short-coming of many problems of this type.

It's often the case that for any fraction of a single compounding period that's "left over", simple interest is computed for that extra amount of time. With this method, find the value of the account at x = 4, then see if the values can be equal at any time in the 4th year using simple interest.

(Edited slightly.)

Last edited: Apr 16, 2015
9. Apr 16, 2015

### ConstantineO

I don't wish to sound like an imbecile, but I have no clue what that means. How would I set up a systems of equation if I subbed in 4 for both x's? I believe I would be left with only one unknown for either equation, or am I misunderstanding you? Please clarify what you mean by using x=4.

10. Apr 16, 2015

### SammyS

Staff Emeritus
When x = 4, (7years for Romeo, 4 years for Juliet), what is the value in each in each account?

Start from that point for each & using simple interest, and see how long it takes for the values to be equal.

11. Apr 16, 2015

### ConstantineO

I am not familiar with the simple interest formula, so I googled it. I am operating under the assumption that it is different than the compound interest formula.

I am to assume this is correct?
Simple interest Formula
I = "the grown money"
p = the initial capital
r = interest rate per year
t = t
(I) = (p)(r)(t)

I think I know what you're getting at, so let me make an attempt.

Romeo Compound Interest Calculation Total
Ar = 10,000(1.03)^4+3
Ar = 10,000(1.03)^7
Ar = 12,298.73865

Julie Compound Interest Calculation Total
Aj = 10,000(1.05)^4
Aj = 12,155.0625

Romeo Simple Interest Calculation
(Ir) = (12,298.73865)(0.03)(t)
(Ir) = (368.94)(t)

Juliet Simple Interest Calculation
(Ir) = (12,155.0625)(0.05)(t)
(Ir) = 607.753125(t)

Equate the two to equal each other.

(368.94)(t) = 607.753125(t)
(368.94)(t) -607.753125(t) = 0
t(368.94-607.753125)=0

This doesnt work though...

12. Apr 16, 2015

### Ray Vickson

It's not that complicated. Let $R_t, J_t$ be the amounts in Romeo's and Juliet's accounts at time $t$ (in years, measured from Romeo's 16th birthday). We have:
$$\begin{array}{ccc} & t=7 & t=8 \\ R_t & 12298.74 & 12667.70 \\ J_t & 12155.06 & 12762.82 \end{array}$$
You can draw two straight-line plots, one going from x = 0 at (7,R7) to x = 1 at (8,R8) and another from x = 0 at (7,J7) to x = 1 at (8,J8). Where the two lines cross is the point where simple interest calculations (for the partial year) would give you equality of monetary values. This will be close to (but not exactly equal to) the value x = 0.611---that is, for time 7.611 ---that your previous calculation would have produced. (The difference is due to the slight curvature in the money vs.time graph over the year, due to continuous compounding over the year, as compared with the straight line obtained from simple interest accumulation over the year.)

13. Apr 16, 2015

### ConstantineO

Could you show me an example of this because I am simply not understanding what you're saying, or can you show me how to equate the two together using algebra?

14. Apr 17, 2015

### ConstantineO

This is getting out of hand, so I am going to try to be as clear and as concise as possible. I know how to calculate the correct answer for this question, and I realize where I first made my mistake. I am now wondering what everyone is talking about when they mention using simple interest. I have literally 0 experience doing any simple interest calculations, and I have no idea what sammyS is talking about here.

If anyone is holding information back because they believe an attempt has not been made and it would violate forum rules, please stop. I understand how to do the book's question using the books method, and I know and where the discrepancy between the 4.61103 and 7.61103 came from. I have made a wholehearted attempt so please for sake of my sanity just give me an example or step by step breakdown. I learn through examples, I look at the process involved, and I create a model in my head how everything interacts and relates with each other.

What I am seeking is an explanation and a simple example of what this simple interest method is for calculating the 0.61103 year after the exact 7 years has passed.

What I am understanding so far.
- First use the compound interest formula to create outputs for both Romeo's and Juliet's accounts after being influenced by exactly 7 years of interest.
- This is done by assigning "4" to the variable x
- Get said products, in this case being:
Romeo's Total After Exactly 7 Years = 12,298.73865
Juliet's Total After Exactly 7 Years = 12,155.0625
- Since you know that the two amounts are still not equal, you must calculate the remaining time between the two using the Simple interest formula
- This is what I am having problems with and what I would appreciate having an example for. Preferably shown algebraically, so I am not plotting nearly straight lines in Desmos.

Not to sound contentious, but when you try to find the point of intersect of two nearly straight lines with a slope that is in hundredths of a unit, it is just plainly byzantine. I am probably doing this wrong, but graphically representing each simple interest formula and trying to find where they meet is insane.

Last edited: Apr 17, 2015
15. Apr 17, 2015

### Ray Vickson

How could I have made my explanation any simpler? There was no hidden information or holding back of anything. I said: just draw two straight-line graphs for Romeo and Juliet, where the lines connect their (time,money) points at the start and end of the final year.

The true graphs of time vs. money will be curved, because of compound interest, but over a short period such as one year the "curvature" will be small, and the graph will look almost like a straight line; replacing the curve by a straight line ---only for that single year---would give you the "simple" interest schedule for that year. It will be almost the same as the compound interest schedule, because the curvature is small over short times such as a year.

If you don't believe me, just draw the graphs of money vs. time for Romeo and for Juliet. You will see that they curve up, but are almost straight over short periods. The only way to really understand it is to sit down and do it.

16. Apr 17, 2015

### ConstantineO

I am going to assume the two lines would be plotted as
y=(12155.0625)(0.05)(x)
and
y=(12298.73865)(0.03)(x)

If that's the case, I don't understand how any human being is supposed to find the point of intersect graphically like this.

I did sit down and do it. I have been sitting down and ripping my hair out doing this for sometime.

Edit - In the event that anyone else would like to question how committed I am to "sitting down and doing it." I've had enough of that nonsense from teachers with superiority issues and over bloated opinions that like to question how hard I am making an attempt.

Last edited: Apr 17, 2015
17. Apr 17, 2015

### Ray Vickson

As long as you persist in trying to plot the wrong thing you will need to keep pulling out your hair. Go back and read what I wrote in #12. Do the plot exactly as I indicated there.

Better still plot the two curves y = 10000 * (1.03)^x and y = 10000 * (1.05)^(x-3) for x = from 3 to 8. They are curved, aren't they? Don't they look almost straight over the shorter interval 7 \leq x \leq 8? in each case if you were to plot a straight line from (7,y(7)) to (8,y(8)) it would look very close to the actual curve (x,y(x)) for x between 7 and 8. The "simple interest" effect between 7 and 8 would be the straight line, while the "compound interest" effect would be the curve. They both pass through the same points at 7 and 8, but they differ in between.

18. Apr 17, 2015

### ConstantineO

As I have stated before.
I was completely uncertain of what to plot. I am being told to use the simple interest formula, but the two formulas you have provided are compound interest formulas:
y = 10000 * (1.03)^x
y = 10000 * (1.05)^(x-3)
I plotted these long before I even got to this whole simple interest business when trying to figure out the original discrepancy between 7.61103 and 4.61103. I am fully aware that the compound interest lines are nearly straight. I don't see how the average rate of change between x =7 and x =8 is going to help me discover the remaining time of 0.61103 years. I am still unclear of what to plot? Do I plot the compound interest based functions for Romeo and Juliet, or do I plot the Simple interest functions? I have done both and I am not seeing anything that is giving me any kind of better understanding. Is this operation you describe too difficult represent algebraically?

I am getting far too irritated by this and far too frustrated and am quickly losing the desire to continue.

19. Apr 17, 2015

### ConstantineO

I was on the right track here. There is no need for this graphing nonsense. I forgot a single number which was my "+ 3" in my simple interest formula. I was a fool not to recognize that the lack of a constant would render my simple interest system of equation unsolvable. The lack of anyone speaking up about this is worrisome. In the future, when referencing the slope of a secant line between the range of two x values of a curve, please write in the notation of 7 < x < 8. I had absolutely no clue what you were talking about.

So let's try that last bit again with a fixed formula.

Romeo Simple Interest Calculation
(Ir) = (12,298.73865)(0.03)(t+3)
(Ir) = (368.94)(t+3)

Juliet Simple Interest Calculation
(Ir) = (12,155.0625)(0.05)(t)
(Ir) = 607.753125(t)

Now the Systems of Equation
(607.753125)(t) = (368.94)(t+3)
(607.753125)(t) = (368.94)(t)+ 1106.82
t(607.753125-368.94) = 1106.82
t(238.813125) = (1106.82)
t = (1106.82)/(238.813125)
t = 4.634669891
Not too far away from 4.61103. I wonder why...

Let's try the simplified interest formula that measures time from Julias deposit date.

Romeo Simple Interest Calculation
(Ir) = (12,298.73865)(0.03)(t)
(Ir) = (368.94)(t)

Juliet Simple Interest Calculation
(Ir) = (12,155.0625)(0.05)(t-3)
(Ir) = 607.753125(t-3)

607.753125(t-3)= (368.94)(t)
(607.753125)(t) - 1823.259375 = (368.94)(t)
(607.753125)(t) - (368.94)(t) =1823.259375
t(607.753125 - 368.94) = 1823.259375
t(238.813125) = 1823.259375
t = 7.634.634669891
Not too far away from 7.61103. Surprise surprise....

Look Ma! No graphs.
7.634.634669891 - 4.634669891 = 3 just like 7.61103 - 4.61103 =3. I wonder if they're related?
I don't think I am wrong by stating that the time after the 7 year mark would actually be 0.634669891 of a year instead of 0.61103 if fractional compound interest is indeed calculated with simplified interest.

We can take things a step further and look at the secant line's slope of the curve that models interest from Romeo's deposit date during 7 < x < 8. Let's look at the average rate of change for both Romeo's and Juliet's account.

Romeo Compound Interest AROC: 7 < x < 8

While x = 4
Ar = 10,000(1.03)^4+3
Ar = 10,000(1.03)^7
Ar = 12,298.73865
x = 4
y =12,298.73865

While x =5
Ar = 10,000(1.03)^5+3
Ar = 10,000(1.03)^8
Ar = 12,667.70081
x = 5
y = 12,667.70081

Romeo's AROC
= (12,667.70081 - 12,298.73865) / (5 -4)
= 368.96216

Juliet's Compound Interest AROC 7 < x < 8

While x = 4
Aj = 10,000(1.05)^4
Aj = 12,155.0625
x = 4
y =12,155.0625

While x = 5
Aj = 10,000(1.05)^5
Aj = 12,762.81563
x = 5
y = 12,762.81563

Juliet's AROC
= (12,762.81563 - 12,155.0625) / (5-4)
=607.7531

After that huge bunch of calculations we now have slopes that we can create linear relations with.

Romeo's Linear Relation
y = (368.96216)(x + 3)

Juliet's Linear Relation
y = 607.7531(x)

Let's see what the Solution is for these in equations when put into a system.

(368.96216)(x + 3) = 607.7531(x)
(368.96216)(x) + 1106.88648 = 607.7531(x)
607.7531(x) -(368.96216)(x) = 1106.88648
x(607.7531-368.96216) = 1106.88648
x(238.783884) = 1106.88648
x = 4.635515854

Notice a pattern?

Time Measured from Romeo's Deposit Compound Calculation Product
x = 4.61103
Time Measured from Romeo's Deposit Simplified Interest Product
x = 4.634669891
Time Measured from Romeo's Deposit AROC: 7 < x< 8 Product
x = 4.635515854

I think its safe to say that they matched sometime in the range of 0.635515854 - 0.634669891- 0.61103 of the start of the 8th year. I think I made my point. I don't need any graphs to know how to rock, and I certainly showed that I sat down and did the work.

20. Apr 17, 2015

### Ray Vickson

Of course it can be done without graphs. Graphs can be of help in setting up the algebraic equations that must, eventually, be solved without graphs. However, you seemed to not understand how simple interest works (your claim, not mine) and to see that a graphical representation can sometimes be helpful---not always, just sometimes. If it was not helpful to you, fine. And, of course I suggested plotting the compound-interest graphs, but I guess you missed out the part where I said that during a short period, such as 1 year, the graph looks almost straight, and that a straight line replacement for the graph (but ONLY in that single year) gives you the simple-interest effect within the year.

Your writeup is almost incomprehensible to me, but your final answer seems OK. You say you still do not know why it is different from the original answer, and that is precisely what I was speaking of when I mentioned graphs: you could see right away why there is a difference.

Last edited: Apr 17, 2015


Finding common terms of two or more arithmetic sequences

Suppose I have three sequences $\{1,4,7,....,2998\}$ , $\{1,3,5,7,9,11,....,3001\}$ and $\{1,6,11,....,4001\}$ .

How can i find the number of common terms among them ?

For Example ,

If I have

1,3,5,7,9,11,13,15,17 and 19

1,4,7,10,13,16 and 19

1,6,11 and 16

My answer would be $6$.

Suppose i have $n$ number of series' with common differences $a_1,a_2,...,a_n$ and each of them having the starting term as $1$ . How can i find the number of common terms then ?

• Does your answer go all the way to the ends 2998,3001,4001 for the count of 0nly 6 common terms? – coffeemath Dec 5 '16 at 15:15
• its 6 for only the given example – psil123 Dec 5 '16 at 15:16

Write the arithemtic sequence in form: $a_n = a_0 + (n-1)d_1, b_n = b_0 + (n-1)d_2, c_n = c_0 + (n-1)d_3$. Now if they have a common term then we can write:

$$x = a_0 + kd_1 = b_0 + sd_2 = c_0 + td_3$$

As the common difference is known we can write this as:

$$x \equiv a_0 \pmod {d_1}$$ $$x \equiv b_0 \pmod {d_2}$$ $$x \equiv c_0 \pmod {d_3}$$

This is system of linear congurence relations and it can be easily solved by the Chinese Remainder Theorem.

And once you find one common element, to find the next common element you just add $LCM[d_1,d_2,d_3]$ to the previous one. In fact if you get $x \equiv A \pmod{LCM[d_1,d_2,d_3]}$ when solving the system of congurences, then total number of elements should be:

$$1 + \left\lfloor\frac{K-A}{LCM[d_1,d_2,d_3]}\right\rfloor$$

where $K$ is the smallest last element in the arithemtic sequences.

If you at the explicit form of your sequences, which build your sets, you get get that $a_n = 1+3 \cdot n$, $b_n = 1+ 2 \cdot n$ and $c_n =1+5 \cdot n$.

Now you just have to find the least common multiple of 2,3 and 5 and see that all their common terms are $c_n = 1 + 30 \cdot n$

• suppose i have n series with common differences a1,a2,...,an and each of them have the starting number as 1 . How can i find the number of common terms ? – psil123 Dec 5 '16 at 15:17


# Seemingly tricky dice question-probability that one event occurs before another event?

The question is as follows:

You roll two fair dice over and over. Let $$A$$ be the event you see two even sums. Let $$B$$ be the event you see a sum of $$7$$ four times. What is the probability that event $$A$$ occurs before event $$B$$?

I know that for mutually exclusive events with independent trials, the probability that event $$E$$ occurs before event $$F$$ is $$\frac{\mathbb{P}(E)}{\mathbb{P}(E) + \mathbb{P}(F)}.$$ I tried using this formula, but I ran into a problem. I calculated $$\mathbb{P}(A)=\frac{1}{2}\cdot \frac{1}{2}=\frac{1}{4} \ \ \ \ \text{and} \ \ \ \ \mathbb{P}(B)=\left ( \frac{1}{6} \right )^4=\frac{1}{1296}.$$ However, I then realized that these probabilites are the events that two even sums occur $$\textit{in a row},$$ and similarly for my $$\mathbb{P}(B).$$

Does anyone have any suggestions on how to figure this out, or even if this formula is the one I should be using?

Edit: I know there is a geometric distribution involved.

• If it helps approach the problem, A occurs before B is usually just a less obvious way to say A occurs without B – Lord Farquaad Oct 16 '18 at 12:54

Since neither A nor B cares about odd sums that aren't 7, we'll just reroll in those cases and thus we can ignore the probability of those sums occurring.

Thus we're left with 7 in addition to the 6 even sums ($$2,4,6,8,10,12$$).

The probabilities of these are respectively $$6/36$$ and $$(1+3+5+5+3+1)/36 = 18/36$$.

Divide the probabilities of each of these by the sum of both probabilities, to get $$P(7)$$ and $$P(even)$$ such that $$P(7) + P(even) = 1$$ (this is $$P(7) = \frac{1}{4}$$ and $$P(even) = \frac{3}{4}$$).

Now, as bobajob pointed out, the probability of A occurring before B is the complement of the probability of B occurring before A.

$$P(2\ even\ before\ 4\ sevens) = 1-P(4\ sevens\ before\ 2\ even)$$

To have 4 sums of seven before 2 even sums, there can be at most 1 even sum before the 4th seven sum.

Thus we have the following possible sequences:

$$7\ 7\ 7\ 7$$
$$7\ 7\ 7\ even\ 7$$
$$7\ 7\ even\ 7\ 7$$
$$7\ even\ 7\ 7\ 7$$
$$even\ 7\ 7\ 7\ 7$$

Each of the above occurs with the following probability:

$$P(7) * P(7) * P(7) * P(7) = P(7)^4$$
$$P(7) * P(7) * P(7) * P(even) * P(7) = P(even) * P(7)^4$$
$$P(7) * P(7) * P(even) * P(7) * P(7) = P(even) * P(7)^4$$
$$P(7) * P(even) * P(7) * P(7) * P(7) = P(even) * P(7)^4$$
$$P(even) * P(7) * P(7) * P(7) * P(7) = P(even) * P(7)^4$$

Then we have:

$$P(2\ even\ before\ 4\ sevens) = 1-P(4\ sevens\ before\ 2\ even)$$

$$= 1 - P(7)^4 - 4 * P(even) * P(7)^4$$

$$= 1 - (\frac{1}{4})^4 - 4 * \frac{3}{4} * (\frac{1}{4})^4$$

$$= 0.984375$$

## Alternative method

The probability we want will just be the probability of getting 0-3 sums equal to 7 before getting 2 even sums.

$$P(2\ even\ before\ 4\ sevens) = \sum_{i=0}^3P(i\ sevens\ before\ 2\ even)$$

Since one even sum will need to be at the end, we can simply consider all possible positions of the other even sum.

Taking as an example $$i=3$$ (3 7 sums before 2 even sums), we'll have the following possible order of events:

$$7\ 7\ 7\ even\ even$$
$$7\ 7\ even\ 7\ even$$
$$7\ even\ 7\ 7\ even$$
$$even\ 7\ 7\ 7\ even$$

The amount of these we have is simply $$i + 1$$.

Each of the above occurs with probability $$P(even)^2 * P(7)^i$$:

$$P(7) * P(7) * P(7) * P(even) * P(even) = P(even)^2 * P(7)^3$$
$$P(7) * P(7) * P(even) * P(7) * P(even) = P(even)^2 * P(7)^3$$
$$P(7) * P(even) * P(7) * P(7) * P(even) = P(even)^2 * P(7)^3$$
$$P(even) * P(7) * P(7) * P(7) * P(even) = P(even)^2 * P(7)^3$$

Thus we have:

$$P(i\ sevens\ before\ 2\ even) = (i+1) * P(even)^2 * P(7)^i$$

This gives us:

$$P(2\ even\ before\ 4\ sevens) = \sum_{i=0}^3(i+1) * P(even)^2 * P(7)^i$$

$$= P(even)^2 * (1 + 2*P(7) + 3*P(7)^2 + 4*P(7)^3)$$

$$= (\frac{3}{4})^2 * (1 + 2*\frac{1}{4} + 3*(\frac{1}{4})^2 + 4*(\frac{1}{4})^3)$$

$$= 0.984375$$

More generally, the positions of the even sums above will be a multiset permutation and one can come up with general expression for the probability of M events X occurring before N events Y, but that's a bit beyond the scope of this question.

• Nice approach. Would it not be easier to calculate the probability of event $B$ occurring before $A$ and then take the complement though? ($i$ would just be 0 or 1...) – bobajob Oct 16 '18 at 10:41
• @bobajob Good point, edited. – Dukeling Oct 16 '18 at 11:53
• "Since neither A nor B cares about odd sums that aren't 7" Yes, they do. A sum of 2 followed by a sum of 3 followed by a sum of 4 does not constitute an instance of A, while a sum of 2 followed by a sum of 4 does. – Acccumulation Oct 16 '18 at 15:20
• After rereading the question, I likely misunderstood it; I thought it was two even sums in a row. – Acccumulation Oct 16 '18 at 15:30

I would do a Markov chain with the states being the number of even rolls/the number of seven rolls. Work backwards starting from the state that you have seen one even roll and three $$7$$s. What is the chance that A comes first from there?

You have two Bernoulli processes,$$S_A$$ and $$S_B$$, and you are asked about the probability that the 2nd arrival in $$S_A$$ process occurs before the 4th arrival in $$S_B$$ process. PMF of the time of $$k$$-th arrival in a Bernoulli process with probability of success $$p$$ is $$p_{X_k}(t)=\binom{t-1}{k-1}p^k(1-p)^{t-k}, \ t=k,k+1,\ldots$$

PS: the events "sum is even" and "sum is 7" are dependent, and it makes the question tricky indeed, and the trick is, as Dukeling explained, is to ignore odd sums not equal to $$7$$; then the (conditional) probability of getting the sum of $$7$$ is $$\frac{6}{36-12}=\frac{1}{4}$$. Now the complement of the event of interest is the event that the 4th arrival in the Bernoulli process with $$p=1/4$$ occurs at time $$4$$ or $$5$$, and its probability is equal to $$\binom{3}{3}p^4+\binom{4}{3}p^4(1-p)=p^4(1+4(1-p))=\frac{1}{64}$$ and the final answer is $$1-\frac{1}{64}=\frac{63}{64}$$


# Inequality for Fibonacci to find an upper bound of harmonic Fibonacci series

I want to find an sharp upper bound for $$\sum_{n=1}^{\infty}\frac{1}{F_n}$$which $F_n$ is the n$th$ term of Fibonacci sequence . I wrote a Matlab program to find an upper bound ,$\sum_{n=1}^{10^6}\frac{1}{F_n}<4$
Now my question is:(1):Is there an inequality to find this ?
(2): Is that series have a close form ? $${F_n} = \frac{{{\varphi ^n} - {{( - \varphi )}^{ - n}}}}{{\sqrt 5 }}\to \\\sum_{n=1}^{\infty}\frac{1}{F_n}=\sum_{n=1}^{\infty}\frac{\sqrt 5}{{{\varphi ^n} - {{( - \varphi )}^{ - n}}}}\\\leq \sum_{n=1}^{\infty}\frac{\sqrt 5}{{{(\frac{{1 + \sqrt 5 }}{2} ) ^n} }}=\frac{\sqrt5}{1-\frac{1}{\frac{{1 + \sqrt 5 }}{2}}}\approx12.18\\$$I am thankful for a hint or solution which can bring a sharper upper bound .

• maybe related – MAN-MADE Sep 1 '17 at 7:33
• Simple fast program: 3.359885666243177553172011302918927179688905133731968486495553815325130318996683383615416216456790087297045342928853913304136789017100883679591351733077119078580333550332507753187599850487179777897006039564509215375892775265673354024033169441799293934610992626257964647651868659449710216558984360881472693249591079473873673378523326877499762727757946853676918541981467668742998767382096913901217722024405208151094264934951 – Kenny Lau Sep 1 '17 at 7:33
• WolframAlpha simply returns ℱ suggesting that it has no closed form. – Kenny Lau Sep 1 '17 at 7:35
• @KennyLau:Can I see your program ? can you post it here ? – Khosrotash Sep 1 '17 at 7:35
• $F_n-\phi^n/\sqrt5=-(-1/\phi)^n/\sqrt5$ has alternating signs. Is it clear that the errors have a sum with the correct sign, and that your inequality follows? – Jyrki Lahtonen Sep 1 '17 at 21:02

As Jyrki Lahtonen points out in the comments, $\sum_{n=1}^\infty\frac{\sqrt5}{\varphi^n}$ isn't necessarily the right bound, since it doesn't dominate the original series term-by-term.

As for a closed form, this identity is known: $$\sum_{n=1}^\infty\frac{1}{F_n}=\frac{\sqrt5}{4}\left(\vartheta_2^2(\varphi^{-2}) + \frac{\log5 + 2\psi_{\varphi^{-4}}(1) - 4\psi_{\varphi^{-2}}(1)}{2\log\varphi}\right)$$ where $\vartheta_2(q)$ is the Jacobi theta function at $z=0$, and $\psi_q$ is the $q$-digamma function. See Wikipedia and MathWorld on the "Reciprocal Fibonacci constant", and other Math.SE questions such as What is the sum of Fibonacci reciprocals?

• $F_n-\phi^n/\sqrt5=-(-1/\phi)^n/\sqrt5$ has alternating signs. Is it clear that the errors have a sum with the correct sign? The OP suffers from the same problem. – Jyrki Lahtonen Sep 1 '17 at 20:59
• @JyrkiLahtonen Whoops! Let me fix that. – Chris Culter Sep 1 '17 at 21:12

Here is a systematic method for computing upper bounds for the sum without much work.

By induction, if $F_N \ge b^N$ and $b+1 \ge b^2$, then $F_n \ge b^n$ for $n \ge N$.

Therefore, $$\sum_{n=1}^\infty {1\over F_n} \le \sum_{n=1}^{N-1} {1\over F_n} + \sum_{n=N}^\infty {1\over b^n} = \sum_{n=1}^{N-1} {1\over F_n} + \frac{1}{b^{N-1}(b-1)}$$ This upper bound gets closer to the actual sum when $b$ gets larger, but then we need larger $N$:

\begin{array}{crl} b &N &sum \\ 1.3 &4 &4.0172204521317 \\ 4/3 &5 &3.7825520833333 \\ 1.4 &6 &3.4981694135380 \\ 1.5 &11 &3.3651521005948 \\ 1.6 &72 &3.3598856662432 \\ \end{array}

Since $1.6 \approx \phi$, which is the largest possible $b$, the last value is quite close to the actual value: $$3.359885666243177553172011302918927179688905133732\cdots$$

Using Wolfram Mathematica answer is : Wolfram Mathematica Code


Making statements based on opinion; back them up with references or personal experience. Why did mainframes have big conspicuous power-off buttons? Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Useful relations in dealing with binomial coefficients and factorials 4. How to sustain this sedentary hunter-gatherer society? Maybe I'm wrong in the conclusions about what that particular convergence means though. If success probabilities differ, the probability distribution of the sum is not binomial. \Pr[S\ge s] Determination of the binomial coefficient and binomial distribution The probability of any specified arrangement of k successes and n-k failures in n independent trials is pknkq − where p is the probability of success on any one trial and q=1-p is the probability of failure. Often the manipulation of integrals can be avoided by use of some type of generating function. "In the limit as n→∞, your binomials become Gaussian" Sorry but this is simultaneously vague and wrong. Asking for help, clarification, or responding to other answers. Why were there only 531 electoral votes in the US Presidential Election 2016? That depends on the range of values you are considering. where we took $t=\log(s/\sum_ip_i)$. $$By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy. Why Is an Inhomogenous Magnetic Field Used in the Stern Gerlach Experiment? site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa. The Kolmogorov approximation is given as an … Yes, in fact, the distribution is known as the Poisson binomial distribution, which is a generalization of the binomial distribution. See the binomial sum variance inequality. I know that I can solve this exercise by using the fact that a negative binomial distributed RV is a sum of geometric distributed RV, but i want to show it with my attempt. Both distributions have total mass 1. How do rationalists justify the scientific method. rev 2020.11.24.38066, The best answers are voted up and rise to the top, Mathematics Stack Exchange works best with JavaScript enabled, Start here for a quick overview of the site, Detailed answers to any questions you might have, Discuss the workings and policies of this site, Learn more about Stack Overflow the company, Learn more about hiring developers or posting ads with us, I have the same question and i read the paper (The Distribution of a Sum of Binomial Random Variables by Ken Butler and Michael Stephens). @jameselmore Additivity of the means is unrelated to independence. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. \\&= \exp\left(\sum_i 1 + (e^t-1) p_i\right) \exp(-st) It will be a special case of the Poisson Binomial Distribution. Are there relatively simple formulae or at least bounds for the distribution \Pr[S\ge s] \\&= \exp\left(\sum_i 1 + (e^t-1) p_i\right) \exp(-st) Extremely bloated transaction log during delete. Every second customer converts better. See this paper (The Distribution of a Sum of Binomial Random Variables by Ken Butler and Michael Stephens). Which one is more idiomatic: ‘valid concern’ or ‘legitimate concern’? Can this be by chance? To subscribe to this RSS feed, copy and paste this URL into your RSS reader. If success probabilities differ, the probability distribution of the sum is not binomial. Here is an excerpt from the Wikipedia page. by Marco Taboga, PhD. The distribution of a sum S of independent binomial random variables, each with different success probabilities, is discussed.$$ @Robert ,do you have any insight on what happens if the n is not same for the 2 distributions. This lecture discusses how to derive the distribution of the sum of two independent random variables.We explain first how to derive the distribution function of the sum and then how to derive its probability mass function (if the summands are discrete) or its probability density function (if the summands are continuous). This answer provides an R implementation of the explicit formula from the paper linked in the accepted answer (The Distribution of a Sum of Binomial Random Variables by Ken Butler and Michael Stephens).


# Is there a series where the terms tend to zero faster than the harmonic series but it still diverges?

I know that for the harmonic series $\lim_{n \to \infty} \frac1n = 0$ and $\sum_{n=1}^{\infty} \frac1n = \infty$.

I was just wondering, is there a sequence ($a_n =\dots$) that converges "faster" (I am not entirely sure what's the exact definition here, but I think you know what I mean...) than $\frac1n$ to $0$ and its series $\sum_{n=1}^{\infty}{a_n}= \infty$?

If not, is there proof of that?

• Sure. Let $a_n=\frac1{n\log n}$. Or let $a_n=\frac1{n\log n\log\log n}$. Or let ... In fact, the process never ends, in that you can find a divergent series whose terms go to zero faster than all the sequences I suggested. – Andrés E. Caicedo Dec 1 '13 at 19:39
• Versions of this question have been asked before. Here is an example from MO. – Andrés E. Caicedo Dec 1 '13 at 19:41
• ok, it this checks out! (using the condensation test) – guynaa Dec 1 '13 at 19:46
• Related The answers by by Bill/Gone and Yuval. – user17762 Dec 1 '13 at 20:15
• $$\sum_{n=1}^{\infty} \frac{1}{10n} ?$$ – Sawarnik Feb 24 '14 at 21:13

## 3 Answers

There is no slowest divergent series. Let me take this to mean that given any sequence $a_n$ of positive numbers converging to zero whose series diverges, there is a sequence $b_n$ that converges to zero faster and the series also diverges, where "faster" means that $\lim b_n/a_n=0$. In fact, given any sequences of positive numbers $(a_{1,n}), (a_{2,n}),\dots$ with each $\sum_n a_{i,n}=\infty$ and $\lim_n a_{i+1,n}/a_{i,n}=0$, there is $(a_n)$ with $\sum a_n=\infty$ and $\lim_n a_n/a_{i,n}=0$ for all $i$.

To see this, given $a_1,a_2,\dots$, first define $b_1=a_1,b_2=a_2,\dots,b_k=a_k$ until $a_1+\dots+a_k>1$. Second, let $b_{k+1}=a_{k+1}/2,b_{k+2}=a_{k+2}/2,\dots,b_n=a_n/2$ until $a_{k+1}+\dots+a_n>2$, etc. That is, we proceed recursively; if we have defined $b_1,\dots,b_m$ and $b_m=a_m/2^r$, and $b_1+\dots+b_m>r+1$, let $b_{m+1}=a_{m+1}/2^{r+1},\dots,b_l=a_l/2^{r+1}$ until $a_{m+1}+\dots+a_l>2^{r+1}$. The outcome is that $\sum b_i=\infty$ and $\lim b_i/a_i=0$.

Similarly, given $(a_{1,n}),(a_{2,n}),\dots$, with each $(a_{k+1,n})$ converging to zero faster than $(a_{k,n})$, and all of them diverging, let $a_i=a_{1,i}$ for $i\le n_1$, where $a_{1,1}+\dots+a_{1,n_1}>1$, then $a_i=a_{2,i}$ for $n_1<i\le n_2$, where we ask both that $a_{2,n_1+1}+\dots+a_{2,n_2}>1$ and that for any $k>n_2/2$ we have $a_{2,k}/a_{1,k}<1/2$, etc. That is, if we have defined $n_k$, we let $a_i=a_{k+1,i}$ for $n_k<i\le n_{k+1}$ where $n_{k+1}$ is chosen so that $a_{k+1,n_k+1}+\dots+a_{k+1,n_{k+1}}>1$ and for all $l>n_{k+1}/2$ we have $a_{k+1,l}/a_{i,l}<1/2^{k+1}$ for all $i<k+1$. Then the series $\sum a_i$ diverges, and the sequence $(a_i)$ converges to $0$ faster than all the $a_{i,n}$. In modern language, we would say that there are no $(\omega,0)$-gaps in a certain partial order.

We can modify the above slightly so that given any sequences $(a_{i,n})$ with $\sum_n a_{i,n}<\infty$ and $\lim_n a_{i+1,n}/a_{i,n}=\infty$ for all $i$, we can find $(a_n)$ with $\sum_n a_n<\infty$ and $\lim_n a_n/a_{i,n}=\infty$, so there is no fastest convergent series, and not even considering a sequence of faster and faster convergent series is enough. (In modern terms, there is no $(0,\omega)$-gap.)

What we cannot do in general is, given $(a_{i,n})$, with all $\sum_n a_{i,n}=\infty$, find $(a_n)$ with $\sum a_n=\infty$ and $a_n/a_{i,n}\to0$ for all $i$, if the $a_{i,n}$ are not ordered so that $a_{i+1,n}$ converges to zero faster than $a_{i,n}$. For example, we can have $a_n=1/n$ if $n$ is odd and $a_n=1/n^2$ if $n$ is even, and $b_n=1/n^2$ if $n$ is odd and $b_n=1/n$ if $n$ is even, and if $c_n$ converges to zero faster than both, then $\sum c_n$ converges. (These exceptions can typically be fixed by asking monotonicity of the sequences, which is how these results are usually presented in the literature.)

Note that the argument I gave is completely general, no matter what the series involved. For specific series, of course, nice "formulas" are possible. For example, given $a_n=1/n$, we can let $b_n=1/(n\log n)$ for $n>1$. Or $c_n=1/(n\log n\log\log n)$, for $n\ge 3$. Or ... And we can then "diagonalize" against all these sequences as indicated above.

By the way, the first person to study seriously the boundary between convergence and divergence is Paul du Bois-Reymond. He proved a version of the result I just showed above, that no "decreasing" sequence of divergent series "exhausts" the divergent series in that we can always find one diverging and with terms going to zero faster than the terms of any of them. A nice account of some of his work can be found in the book Orders of Infinity by Hardy. Du Bois-Reymond's work was extended by Hadamard and others. What Hadamard proved is that given $(a_i)$ and $(b_i)$ with $\sum a_i=\infty$, $\sum b_i<\infty$, and $b_i/a_i\to 0$, we can find $(c_i),(d_i)$ with $c_i/a_i\to0$, $b_i/d_i\to 0$, $d_i/c_i\to0$, $\sum c_i=\infty$, $\sum d_i<\infty$. More generally:

If we have two sequences of series, $(a_{1,n}), (a_{2,n}),\dots$ and $(b_{1,n}),(b_{2,n}),\dots$, such that

• Each $(a_{i+1,n})$ converges to zero faster than the previous one,
• Each $(b_{i+1,n})$ converges to zero slower than the previous one,
• Each $(a_{i,n})$ converges to zero slower than all the $(b_{j,n})$,
• Each $\sum_n a_{i,n}$ diverges, and
• Each $\sum_n b_{i,n}$ converges,

then we can find sequences $(c_n),(d_n)$, "in between", with one series converging and the other diverging.

In modern language, we say that there are no $(\omega,\omega)$-gaps, and similarly, there are no $(\omega,1)$- or $(1,\omega)$-gaps. This line of research led to some of Hausdorff's deep results in set theory, such as the existence of so-called $(\omega_1,\omega_1)$- or Hausdorff gaps. What Hausdorff proved is that this "interpolation" process, which can be iterated countably many times, cannot in general be carries out $\omega_1$ times, where $\omega_1$ is the first uncountable ordinal.

I had wondered about this too a long time ago and then came across this. The series

$$\sum_{n=3}^{\infty}\frac{1}{n\ln n (\ln\ln n)}=\infty$$

diverges and it can be very easily proven by the integral test. But here is the kicker. This series actually requires googolplex number of terms before the partial sum exceeds 10. Talk about slow! It is only natural that if the natural log is slow, then take the natural log of the natural log to make it diverge even slower.

Here is another one. This series

$$\sum_{n=3}^{\infty}\frac{1}{n\ln n (\ln\ln n)^2}=38.43...$$

actually converges using the same exact (integral) test. But it converges so slowly that this series requires $10^{3.14\times10^{86}}$ before obtaining two digit accuracy. So using these iterated logarithms you can come up with a series which converges or diverges "arbitrarily slowly".

Reference: Zwillinger, D. (Ed.). CRC Standard Mathematical Tables and Formulae, 30th ed. Boca Raton, FL: CRC Press, 1996.

• But then by the same integral test $$\sum_{n=N_0}^\infty \sum_{n=3}^{\infty}\frac{1}{n\ln n (\ln\ln n) (\ln\ln \ln n)}=\infty$$ diverges at an even slower rate....Moreo generarily $$\sum \frac{1}{n \ln(n) \ln^2(n) \ln^3(n) ... \ln^k(n)}$$ diverges, where $^j$ denotes composition . – N. S. Dec 2 '13 at 0:46
• @N.S. That's what I said, using iterated logarithm you can come up with an even slower growth. In addition, in your first summation, the double summation doesn't make sense. I think you want the inner sigma removed. $N_0 = \lceil((e^x)^j(0)\rceil$ where $j$ denotes composition. In your first summation with $j=3$ we have $N_0=16$. – Fixed Point Dec 2 '13 at 2:31
• this is a fantastic example--showing that even trying to test convergence by simulation could be doomed, because we don't have the computational capacity to find enough terms to convince ourselves the sequence diverges. – MichaelChirico Apr 14 '15 at 14:56

If we use the notion of a partial sum:

$$S_n = \sum_{k=1}^n a_k$$

you are asking for a series in which the partial sums diverge more slowly than $\sum_{k=1}^n 1/k$ as $n\to\infty$. For this to happen, we just need to find $a_k$ such that $a_k < 1/k$ for all $k>c$ where $c$ is some value.

Look at $a_k = \frac{1}{k\ln k}$. Let's do the integral test to show this diverges. The substitution used is $u = \ln k$ so that $du = dk/k$.

$$\int \frac{dk}{k\ln k}=\int \frac{du}{u}=\ln u = \ln {\ln k}$$

Putting in limits of $2$ and $\infty$ shows that this indeed diverges. And for $k>c=e$, we have that $1/(k\ln k) < 1/k$.


# A simple method of factorization $2^{30}+1$

How can you factor $2^{30} + 1$? This task was supposed to be at one interview, there is an assumption that there should be a simple solution.

Observe that $$x^k+1=\frac{x^{2k}-1}{x^k-1}=\frac{\prod_{d\mid 2k}\Phi_{d}(x)}{\prod_{d\mid k}\Phi_{d}(x)}=\prod_{d\mid 2k,\ d\nmid k}\Phi_{d}(x)$$ With $$\Phi_n(x)$$ being the $$n^\text{th}$$ cyclotomic polynomial. It follows that $$2^{30}+1=\Phi_4(2)\Phi_{12}(2)\Phi_{20}(2)\Phi_{60}(2)$$ With the individual factors computed as $$\Phi_4(2)=2^2+1=5$$ $$\Phi_{12}(2)=2^4-2^2+1=13$$ $$\Phi_{20}(2)=2^8-2^6+2^2-2^2+1=5\times 41$$ $$\Phi_{60}(2)=2^{16}+2^{14}-2^{10}-2^8-2^6+2^2+1=61\times 1321$$ Giving an overall factorization of $$\boxed{2^{30}+1=5^2\times 13\times 41\times 61\times 1321}$$

• This is very elegant. Aug 6 '18 at 1:58
• Thanks! It's also not too hard to compute the relevant polynomials by hand (the section "Easy cases for computation" in the linked wiki article lists some strategies) :) Aug 6 '18 at 2:01
• Again, computing $\Phi_{60}(2) = 61 \times 1321$ is not really something to do in an interview. Aug 6 '18 at 7:26
• Perhaps they wanted to see the way to a solution, not the solution itself. Aug 6 '18 at 11:43
• @RobertIsrael: probably the interviewer wanted to hear something along the lines "in order to find the prime divisors of $\Phi_{60}(2)$, it is enough to check the primes $\equiv 1\pmod{60}$. Since the order of $2$ in $\mathbb{Z}/(61\mathbb{Z})^*$ is what it is, $61$ is a prime divisor of $\Phi_{60}(2)$ and the problem boils down to checking that $1321$ is a prime". Aug 6 '18 at 16:45

I would note it is a sum of cubes and fifth powers, so $2^{10}+1=1025$ and $2^6+1=65$ are both factors. In terms of primes that gives us $5^2\cdot 13 \cdot 41$ as factors. At this point in an interview (depending on the position) I would declare success and move on. Getting the remaining $80581$ would take a bunch of hand calculation and finding $61\cdot 1321$ doesn't seem reasonable either.

• $61\equiv 5 \bmod 8$ so $(2|61)\equiv 2^{30}\equiv -1\bmod 61$. Aug 6 '18 at 1:44

Hint: $a^k+1$ is divisible by $a+1$ if $k$ is odd.

• Just so we can check any number-theoretic derivation... Mathematica gives: $5^2 \times 13 \times 41 \times 61 \times 1321$. (Doesn't seem so simple that it could be done in an interview session...) Aug 6 '18 at 0:37

Yet another easy observation: since $4X^4+1=(2X^2+2X+1)(2X^2-2X+1)$, we get $4\cdot2^{28}+1=(2\cdot2^{14}+2\cdot2^7+1)(2\cdot2^{14}-2\cdot2^7+1)$.

Firstly, in an interview there is often a difference between showing that there is a simple solution (existence) and outlining the approach, versus actually finding the solution.

That is, it might suffice to outline a standard prime factorising algorithm and show that it could be computed in trivial time.

One of the simplest classic approaches is that to factor $x$, you only need to test the primes that are less than $\sqrt{x}$. If $x=2^{30}+1$, then $\sqrt{x+1} \simeq 32768$. There are less than 3000 primes that satisfy this constraint, so it is very feasible on any computing platform.

Once each prime factor was found, one would divide that factor out, and then only need to search for primes up to an even smaller upper bound. Thus after the finding that 5 is a prime, one need only search for other prime factors less than 14654.

Thus, you have an algorithm that would find all the factors of $2^{30}+1$ in ascending order.

That is, $2^{30}+1 = 5 \times 5 \times 13 \times 41 \times 61 \times 1321$.

The key to nearly any sensible prime factorization approach is to efficiently find the first factor. Thus, in some ways it could be said that factoring $2^{30}+1$ is easy because it has lots of prime factors, and most of them are very small. (Contrast this to encryption are based on numbers that are very hard to factor, because they typically one have 2 factors and each of them are very very large.)

Anyway, as @Robert indicated, the key to solving this directly is to realise that if $k$ is odd, then $x^k+1$ can be elegantly factorised, as $(x+1)$ is a factor.

For example, $$x^7+1 = (x+1)(x^6-x^5+x^4-x^3+x^2-x+1)$$ Note that $z^{30}+1 = (z^2)^{15}+1$ and so $z^2+1$ is a factor.

Letting $z=1$ shows that 5 is a factor of $2^{30}+1$.

Similarly, you could use the well-known sum of cubes factorisation. $x^3+1 = (x+1)(x^2-x+1)$, to show that $$2^{30}+1 = (2^{10}+1)(2^{20}-2^{10}+1) = 1025 \times 1047553$$ and continue from there.

• Your early complete factorization is missing $61$ Aug 6 '18 at 1:59


# Fitting a two-dimensional Gaussian to a set of 2D pixels

Imagine I have a set of data like the following:

data = {{0.0453803, 0.0427863, 0.0489815, 0.045243, 0.0488289, 0.0432898,
0.04448, 0.0387732, 0.0388952}, {0.0507668, 0.0427863, 0.0502632,
0.0503395, 0.0634623, 0.0675822, 0.0529335, 0.047425,
0.0387121}, {0.042237, 0.0501259, 0.0595712, 0.0869001, 0.139559,
0.141512, 0.0868391, 0.0579232, 0.0408331}, {0.0478981, 0.0491646,
0.0652628, 0.130404, 0.218448, 0.220645, 0.143603, 0.0605173,
0.0424964}, {0.0462043, 0.0530861, 0.076051, 0.140017, 0.206943,
0.202502, 0.118791, 0.0614023, 0.0459907}, {0.0511788, 0.0582132,
0.105531, 0.166354, 0.181003, 0.13698, 0.0748302, 0.0557107,
0.0492103}, {0.0493629, 0.0539712, 0.0971695, 0.160769, 0.164477,
0.104768, 0.0591745, 0.0475319, 0.0452583}, {0.0510719, 0.0599374,
0.0730602, 0.0975814, 0.101289, 0.0691997, 0.0498054, 0.044892,
0.043122}, {0.0460517, 0.0567025, 0.0574044, 0.0587778, 0.0537118,
0.0487221, 0.0474098, 0.0413977, 0.04477}}

I don't have enough reputation to post an image, but one can easily be generated by applying ListPlot3D to the above data set.

How might I best fit a Gaussian curve to this set of datapoints, and extract properties such at the fit' semi-axes? I noticed that ComponentMeasurements has some functionality for best fit ellipsoids, but that doesn't seem to be workable here.

My objective here is to determine how "Gaussian" a set of points in an image are. My strategy is to sequentially fit a 2D Gaussian to each point, and then to measure it's eccentricity and spread (looking, for example, at the length and ratio of the semiaxes of the ellipsoid corresponding to the fit). The example here seems like it should yield a 2D Gaussian fit with significant spread and a ratio for the semiaxes significantly diverging from one.

-
Maybe You can add some context to the question. I'm asking because this data looks rather like sum of two 2D gaussians, and I don't know if it is relevant. –  Kuba Jun 25 '13 at 22:36
@Kuba I have added a bit of context in the problem description! –  Bob Jun 25 '13 at 22:42
By context I mean, for example, what this data actually is. :) Without details, term "determine how Gaussian" is too vague. –  Kuba Jun 25 '13 at 23:07

Sjoerd's answer applies the power of Mathematica's very general model fitting tools. Here's a more low-tech solution.

If you want to fit a Gaussian distribution to a dataset, you can just find its mean and covariance matrix, and the Gaussian you want is the one with the same parameters. For Gaussians this is actually the optimal fit in the sense of being the maximum likelihood estimator -- for other distributions this may not work equally well, so there you will want NonlinearModelFit.

One wrinkle is that your data doesn't fall off to zero but to something like Min[data] $\approx 0.0387$, but we can easily get rid of that by just subtracting it off. Next, I normalize the array to sum to $1$, so that I can treat it like a discrete probability distribution. (All this really does is allow me to avoid dividing by Total[data, Infinity] every time in the following.)

min = Min[data];
sum = Total[data - min, Infinity];
p = (data - min)/sum;

Now we find the mean and covariance. Mathematica's functions don't seem to work with weighted data, so we'll just roll our own.

{m, n} = Dimensions[p];
mean = Sum[{i, j} p[[i, j]], {i, 1, m}, {j, 1, n}];
cov = Sum[Outer[Times, {i, j} - mean, {i, j} - mean] p[[i, j]], {i, 1, m}, {j, 1, m}];

We can easily get the probability distribution for the Gaussian with this mean and covariance. Of course, if we want to match the original data, we have to rescale and shift it back.

f[i_, j_] := PDF[MultinormalDistribution[mean, cov], {i, j}] // Evaluate;
g[i_, j_] := f[i, j] sum + min;

The match is not too bad, although the data has two humps where the Gaussian has one. You can also compare the fit through a contour plot. (Use the tooltips to compare contour levels.)

Show[ListPlot3D[data, PlotStyle -> None],
Plot3D[g[i, j], {j, 1, 9}, {i, 1, 9}, MeshStyle -> None,
PlotStyle -> Opacity[0.8]], PlotRange -> All]
Show[ListContourPlot[data, Contours -> Range[0.05, 0.25, 0.025],
ContourShading -> None, ContourStyle -> ColorData[1, 1], InterpolationOrder -> 3],
ContourPlot[g[i, j], {j, 1, 9}, {i, 1, 9}, Contours -> Range[0.05, 0.25, 0.025],
ContourShading -> None, ContourStyle -> ColorData[1, 2]]]

The variances along the principal axes are the eigenvalues of the covariance matrix, and the standard deviations (which I guess you're calling the semi-axes) are their square roots.

Sqrt@Eigenvalues[cov]
(* {1.86325, 1.50567} *)

-
Or you could just plot the Gaussian fit coloured by the residual: Show[ListDensityPlot[ Table[data[[i, j]] - g[i, j], {i, 1, m}, {j, 1, m}], InterpolationOrder -> 3, PlotRange -> Full, ColorFunctionScaling -> False, ColorFunction -> (With[{t = 20 #}, RGBColor[1 + t, 1 - Abs[t]/2, 1 - t]] &)], ContourPlot[g[x, y], {y, 1, 9}, {x, 1, 9}, Contours -> Range[0.05, 0.25, 0.025], ContourShading -> None, ContourStyle -> Black]] i.stack.imgur.com/LqGZL.png (orange: data higher than fit, blue: data lower than fit) –  Rahul Narain Jun 27 '13 at 6:23
Thanks again for such a fantastic answer. Just to help me understand - why does your calculation for the square root of the eigenvectors yield a slightly different result than StandardDeviation@MultinormalDistribution[mean,cov]? –  Bob Jun 30 '13 at 11:15
Because that one appears to give the standard deviations of the marginal distributions of $x$ and $y$ instead, which you also get with Sqrt@Diagonal[cov]. –  Rahul Narain Jun 30 '13 at 11:28
data3D = Flatten[MapIndexed[{#2[[1]], #2[[2]], #1} &, data, {2}], 1];

fm = NonlinearModelFit[data3D,
a E^(-(((-my + y) Cos[b] - (-mx + x) Sin[b])^2/(2 sy^2)) -
((-mx + x) Cos[b] + (-my + y) Sin[b])^2/(2 sx^2)),
{{a, 0.1}, {b, 0}, {mx, 4.5}, {my, 4.5}, {sx, 3}, {sy, 3}},
{x, y}
]

Show[
ListPlot3D[data3D, PlotStyle -> None, MeshStyle -> Red],
Plot3D[fm["BestFit"], {x, 1, 9}, {y, 1, 9}, PlotRange -> All,
PlotStyle -> Opacity[0.9], Mesh -> None]
]

fm["BestFitParameters"]

{a -> 0.1871830545, b -> -0.4853901689, mx -> 5.152549499, my -> 5.092511036, sx -> 2.756524919, sy -> 2.072163433}

-

Starting with your data, I would map out the data something like this:

data3D = Flatten[MapIndexed[{#2[[1]], #2[[2]], #1} &, data, {2}], 1]

and then count it like:

data2 = Flatten[Table[{#[[1]], #[[2]]}, {100 #[[3]]}] & /@ data3D, 1];

and then use this function:

FindDistributionParameters[data2,
MultinormalDistribution[{a, b}, {{c, d}, {e, f}}]]

to find the means and coveriance of the data. And then I might do other stuff with the distribution, such as create a distribution object using:

edist = EstimatedDistribution[data2,
MultinormalDistribution[{a, b}, {{c, d}, {e, f}}]]

and then check the distribution against the data, using:

dtest = DistributionFitTest[data2, edist, "HypothesisTestData"]

and create a table of the test results, using:

N[dtest["TestDataTable", All]]

or individually

AndersonDarlingTest[data2, edist, "TestConclusion"]
CramerVonMisesTest[data2, edist, "TestConclusion"]
JarqueBeraALMTest[data2, "TestConclusion"]
MardiaKurtosisTest[data2, "TestConclusion"]
PearsonChiSquareTest[data2, edist, "TestConclusion"]
ShapiroWilkTest[data2, "TestConclusion"]

Now, I'm not a statistician, and I probably only know enough statistics to be dangerous, and I'm not familar with all the tests listed in the table, but I suspect that one of those small numbers is significant in measuring how close the actual data fits the distribution, i.e. how "Gaussian" the set of points is.

Also I might just plot the data as follows and visually judge the gaussiness of the data using these functions (as per VLC's answer to question 2984)

Show[DensityHistogram[d, {.2}, ColorFunction -> (Opacity[0] &),
Method -> {"DistributionAxes" -> "Histogram"}], ListPlot[d]]

or these:

GraphicsColumn[
Table[SmoothDensityHistogram[d, ColorFunction -> "DarkRainbow",
Method -> {"DistributionAxes" -> p}, ImageSize -> 500,
BaseStyle -> {FontFamily -> "Helvetica"},
LabelStyle -> Bold], {p, {True, "SmoothHistogram", "BoxWhisker"}}]]

-

You mentioned in a related question that you would like to do large numbers of these fits quickly.

If each data set has the same dimensions, you can write a fairly fast implementation of Rahul Narain's method by precomputing arrays of x and y coordinates for the data grid, and flattening the data and using Dot to calculate the mean and the elements of the covariance matrix:

x = Table[i, {i, 9}, {j, 9}]//N;
y = Transpose[x];
x = Flatten[x]; y = Flatten[y];

semiaxes[data_] := Module[{min, p, mx, my},
min = Min[data];
p = Flatten[data] - min;
p /= Total[p];
mx = x.p;
my = y.p;
With[{a = (x - mx)^2.p, b = ((x - mx) (y - my)).p, c = (y - my)^2.p},
Sqrt @ Eigenvalues[{{a, b}, {b, c}}]]]

semiaxes[data]
(* {1.86325, 1.50567} *)

This runs in about 340 µs on my PC

Compiling can give you even more speed, but you need to replace Eigenvalues with the explicit symbolic expressions:

semiaxesc =
With[{x = x, y = y},
Compile[{{data, _Real, 2}}, Block[{min, p, mx, my, a, b, c},
min = Min[data];
p = Flatten[data] - min;
p /= Total[p];
mx = x.p;
my = y.p;
a = (x - mx)^2.p;
b = ((x - mx) (y - my)).p;
c = (y - my)^2.p;
{Sqrt[1/2 (a + c - Sqrt[a^2 + 4 b^2 - 2 a c + c^2])],
Sqrt[1/2 (a + c + Sqrt[a^2 + 4 b^2 - 2 a c + c^2])]}],
CompilationTarget -> "C", RuntimeOptions -> "Speed"]];

semiaxesc[data]
(* {1.50567, 1.86325} *)

This runs in about 5.7 µs on my PC.

-
Fantastic. However, I'm getting a "Eigenvalues::matsq : Argument" which is saying that don't have a square matrix. Is there some preprocessing I need to do for the data array I posted? –  Bob Jun 30 '13 at 9:15
Would you mind posting the full script you're running? I'm sure there's some formatting error on my end, but I can't pin it down. Everything works and makes sense, but there seems to be a problem with the Eigenvalue computation on my end. –  Bob Jun 30 '13 at 12:33
That is the full script, apart from the definition of data which I copied from the question. I suggest you step through the code one line at a time and make sure that mx, my, a, b, and c are all single numbers. I'm away from the computer this week, so that's about all the help I can offer at the moment. You could try asking in chat if anyone else can get it working. –  Simon Woods Jun 30 '13 at 14:58
Very good, as long as it's working on your end, I'll be able to fix it on mine. –  Bob Jun 30 '13 at 16:50
The problem was that the dot products were not being recognized as such. Switching a.b for Dot[a,b] did the trick. Very odd. –  Bob Jun 30 '13 at 18:19


# Product of two monotonic real functions

I'm confused about the possibility to say that the product of two monotonic real functions $f,g:\mathbb{R} \to \mathbb{R}$ is monotonic.

I found the following proposition:

A. If $g$ and $f$ are two increasing functions, with $f(x)>0$ and $g(x)>0$ $\forall x$, then $f \, g$ is increasing.

B. If $g$ and $f$ are two increasing functions, with $f(x)<0$ and $g(x)<0$ $\forall x$, then $f \, g$ is decreasing.

Does something similar hold also for decreasing functions? That is: is the following sentence correct?

A'. If $g$ and $f$ are two decreasing functions, with $f(x)>0$ and $g(x)>0$ $\forall x$, then $f \, g$ is decreasing.

B'. If $g$ and $f$ are two decreasing functions, with $f(x)<0$ and $g(x)<0$ $\forall x$, then $f \, g$ is increasing.

Moreover, can something be said about the product of a increasing and a decreasing functions?

For example if $f$ is increasing and $g$ is decreasing under what conditions can I say something about the monotony of the product $f g$?

Besides these two practical questions I would like to ask some suggestions on how to prove statement A.

I tried in the following way

$Hp:$

$x_1 >x_2 \implies f(x_1)>f(x_2)>0 \,\,\, \forall x_1,x_2$

$x_1 >x_2 \implies g(x_1)>g(x_2)>0 \,\,\, \forall x_1,x_2$

$Th:$

$x_1 >x_2 \implies f(x_1) g(x_1)>f(x_2) g(x_2)>0 \,\,\, \forall x_1,x_2$

$Proof:$

$f(x_1)>f(x_2)>0 \,\,\, , g(x_1)>g(x_2)>0 \,\,\, \forall x_1,x_2 \implies f(x_1) g(x_1)>f(x_2) g(x_2)>0 \,\,\, \forall x_1,x_2$

Which seems obvious if one thinks about some numbers but I don't really know how I could prove the last implication in rigourous way. So any help in this proof is highly appreciated.

To prove statement A, let $x > y$. Then, as we know, $f(x) > f(y)>0$ and $g(x) > g(y)>0$. Hence, the following chain of statements proves the claim: \begin{gather} f(x) > f(y) \implies g(x)f(x)> g(x)f(y) \quad(\because g(x)>0)\\ g(x) > g(y) \implies g(x)f(y) > g(y)f(y) \quad(\because f(y)>0)\\ g(x)f(x)> g(x)f(y) > g(y)f(y) \implies fg(x) > fg(y) \end{gather}

An analogous proof would follow for part B if $f$ and $g$ were increasing, with a caveat:let $x > y$. Then, as we know, $f(x) > f(y)$ and $g(x) > g(y)$. Hence, the following chain of statements proves the claim: \begin{gather} f(x) > f(y) \implies g(x)f(x)< g(x)f(y) \quad(\because g(x)<0)\\ g(x) > g(y) \implies g(x)f(y) < g(y)f(y) \quad(\because f(y)<0)\\ g(x)f(x)< g(x)f(y) < g(y)f(y) \implies fg(x) < fg(y) \end{gather}

Now, let us see if the same logic could work with part A':let $x > y$. Then, as we know, $f(x) < f(y)$ and $g(x) < g(y)$. Hence, the following chain of statements proves the claim: \begin{gather} f(x) < f(y) \implies g(x)f(x)< g(x)f(y) \quad(\because g(x)>0)\\ g(x) < g(y) \implies g(x)f(y) < g(y)f(y) \quad(\because f(y)>0)\\ g(x)f(x)< g(x)f(y) < g(y)f(y) \implies fg(x) < fg(y) \end{gather}

That's brilliant, so great intuition for anticipating part A'. Now we will check part B':let $x > y$. Then, as we know, $f(x) < f(y)$ and $g(x) < g(y)$. Hence, the following chain of statements proves the claim: \begin{gather} f(x) < f(y) \implies g(x)f(x)> g(x)f(y) \quad(\because g(x)<0)\\ g(x) < g(y) \implies g(x)f(y) > g(y)f(y) \quad(\because f(y)<0)\\ g(x)f(x)> g(x)f(y) > g(y)f(y) \implies fg(x) > fg(y) \end{gather}

And therefore part B' is also done. Note the above logic carefully, I think all steps are equally important.

Use this logic, and see why in most cases, one increasing and one decreasing function doesn't tell you much about the product itself.

For A' and B', apply A and B. For A': If $f,g$ are decreasing and positive then $-f$ and $-g$ are increasing and negative so by B, the function $(-f)(-g)=fg$ is decreasing. Similarly, apply A to B'.

$e^x$ is increasing and $e^{-x}+1$ is decreasing, and their product $1+e^x$ is increasing.

$e^x+1$ is increasing and $e^{-x}$ is decreasing, and their product $1+e^{-x}$ is decreasing.

The product of a positive increasing and a positive decreasing function can also fail to be monotonic.


# Fair and Unfair coin Probability

I am stuck on this question.

A coin with $P(H) = \frac{1}{2}$ is flipped $4$ times and then a coin with $P(H) = \frac{2}{3}$ is tossed twice. What is the probability that a total of $5$ heads occurs?

I keep getting $\frac{1}{6}$ but the answer is $\frac{5}{36}$.

Attempt: $P($all heads on the four coins$)P($either one of the tosses is heads on the two coins$)+P(3$ heads on the four coins$)P($both coins are heads$)$

$P($all heads on the four coins$) = \left(\frac{1}{2}\right)^4 = \frac{1}{16}$.

$P($either one of the tosses is heads on the two coins$) = 1-P($no heads on both tosses$) = 1-\frac{1}{3}\cdot\frac{1}{3} = \frac{8}{9}$.

$P($exactly $3$ heads on the four tosses$) = \frac{1}{4}$.

$P($both coins are heads$) = \frac{2}{3}\cdot\frac{2}{3} = \frac{4}{9}$.

Final Equation: $\frac{1}{16}\cdot\frac{8}{9}+\frac{1}{4}\cdot\frac{4}{9} = \frac{1}{6}$.

Why am I off by $\frac{1}{36}$?

-
Because "either one of..." $\not \equiv$ " exactly one of..." – Ehsan M. Kermani Jun 9 '13 at 4:31
You claim that the problem is with $P($either one of the tosses is heads on the two coins$)$. You need to calculate the probability of there being precisely one occurrence of a head in the tossing of the second coin. In your calculation, you subtracted the probability of no heads from one. The remaining probability covers one head or both heads, but you want to exclude the latter. If you make this adjustment, you will get the correct answer. – Michael Albanese May 30 '15 at 19:38

The required probability will be

$P($exactly $4$ heads from the $4$ flips of $1$st coin$)\cdot P($exactly $1$ head from the $2$ flips of $2$nd coin $)+$

$P($exactly $3$ heads from the $4$ flips of $1$st coin$)\cdot P($exactly $2$ heads from the $2$ flips of $2$nd coin $)$

Using Binomial Distribution, the required probability $$\binom44\left(\frac12\right)^4\left(1-\frac12\right)^{4-4} \cdot\binom21\left(\frac23\right)^1\left(1-\frac23\right)^{2-1}$$

$$+\binom43\left(\frac12\right)^3\left(1-\frac12\right)^{4-3} \cdot\binom22\left(\frac23\right)^2\left(1-\frac23\right)^{2-2}$$

$$=\frac1{16}\cdot\frac49+\frac14\cdot\frac49=\frac5{36}$$

-


# Parallel Vectors: Missing a Solution

#### (A new question of the week)

We were recently asked to check work on an interesting little question about parallel vectors, and I was almost convinced that there was no solution … until I realized there was one! How was it missed? How can we avoid doing that? That’s our goal today.

## When will these vectors be parallel?

Here is the question, from Brine in mid-September:

Here is my work:

Brine is using column-vector form for the vectors; I’ll be using the more compact bracket notation for convenience.

He’s found the vectors $$\overrightarrow{PQ}=\left\langle3,x^2\right\rangle-\left\langle x,0\right\rangle=\left\langle3-x,x^2\right\rangle$$ and $$\overrightarrow{P_1Q_1}=\left\langle 6,x^2\right\rangle-\left\langle2x,1\right\rangle=\left\langle6-2x,x^2-1\right\rangle$$, and then wrote an equation to say that the components of the two vectors are proportional: $$\frac{6-2x}{3-x}=\frac{x^2-1}{x^2}$$ Solving this yields only an imaginary solution, so it appears to be impossible for the vectors to be parallel.

Hi, Brine.

So your answer is, that there is no such real number x?

Your work almost had me convinced, until I tried solving a different way, and saw that there is an answer.

Look carefully at your work, and think about whether there is any step in which you made an unstated assumption

### How to recognize unstated assumptions

I had graphed the situation in GeoGebra, in such a way that I could vary x and observe the two vectors, to see how the problem worked, expecting perhaps to see why there would be no solution. Here is the case $$x=1.5$$, for example:

But I found that I could make them parallel (as we’ll see below). That gave me reason to look more closely at the work. I’d been fooled by following along with his work rather than starting from scratch to solve the problem myself. (That’s a risk even when you check over your own work, because your mind will follow the same paths again. I should have known better, and I soon did!)

Brine replied,

I tried again but unfortunately I keep ending up that they are not parallel. Can you please give me a hint?

I answered with a more detailed hint:

As I said before, “think about whether there is any step in which you made an unstated assumption“. Here are several points in your work that you should think about:

First, you wrote this equation to say that the vectors are parallel:

When can’t you write such an equation? What fact are you using to justify the equation?

Second, here you canceled to simplify a fraction. When can’t you cancel?

Or you could think of this more generally as a rational equation. What is the domain of this equation? What does simplifying change?

Third, here you multiplied both sides of an equation. When can’t you do that?

Not all of these represent actual errors in your work; but they represent situations where you are making unstated assumptions, or ignoring special cases.

Thinking about exactly what you are doing, and what justifies each step, can be a valuable exercise when you have a wrong (extraneous or missing) solution. The answers to my questions are …

1. He’s justifying the proportion because parallel vectors have proportional components … but that isn’t true when any of those components are zero.
2. You can’t cancel when the factor you cancel can be zero.
3. Simplifying by canceling can change the domain, introducing extraneous roots that are valid in the new equation, but are not in the domain of the original.
4. You can’t multiply an equation by a factor that might be zero, because the new equation may be true when the original is not.

Which is the key issue? We’ll see.

### Examples

The same sorts of problems can arise in more familiar problems, so I pointed out a couple examples:

For a similar issue, when you want to check whether two lines are parallel, you have to consider two cases: Either their slopes are equal or … what?

For another similar issue, consider how to solve an equation like x2 = 2x. It seems obvious that you can divide by x and get x=2; but that misses a solution. Why? Because you might be dividing by 0, which isn’t legal. When you divide by x, you are implicitly assuming that x≠0, which you don’t know to be true. The better way is to rearrange and factor: x2 -2x = 0 factors as x(x-2) = 0, and the solutions are x=0 and x=2.

I’m intentionally trying not to give direct hints too soon, because this is a very valuable lesson to learn; as I indicated, I was almost fooled, so it is rather subtle. But it happens a lot, and I want you to have a big “aha” moment you won’t forget.

In checking for parallel lines, checking the slopes won’t catch a case where they don’t have slopes (vertical lines); that is the most direct hint I gave here. The second example illustrates how a solution can be missed because of an unstated assumption (that what you divide by is not zero).

### Finding the answer by an imperfect method

Brine wrote back:

Oh ok I understand you. Is this the answer? 3?

This time Brine has cross-multiplied without first canceling: $$\frac{6-2x}{3-x}=\frac{x^2-1}{x^2}\$$6-2x)(x^2)=(x^2-1)(3-x)\\6x^2-2x^3=3x^2-x^3-3+x\\-x^3+3x^2-x+3=0 and then solved the cubic equation by factoring (by grouping). This gave two solutions: the imaginary solutions \(x=\pm i$$ we saw before, and also $$x=3$$. This work is better, but … I answered, Yes, that’s correct. What you’ve done here is, I think, to cross-multiply your equation (6-2x)/(3-x) = (x2-1)/x2, and solve the resulting cubic. This amounts to factoring instead of dividing, as I recommended, though you started with a division (in writing the equation in the first place). Presumably you then checked that x = 3 worked. Another way to think of it is to go ahead and do what you originally did, but then check whether canceling the x-3 factors eliminated a solution. That is, one could just recognize that it was assumed that $$x-3\ne0$$, and check to see if the opposite assumption produces a solution. Rather than avoiding the assumption, we would be making the assumption explicit, and taking the contrary assumption as a second case. ### The equation doesn’t fully represent the problem Unfortunately, that check would fail! He’s missed a more fundamental error: But did you observe that, when you put x=3 into your initial equation, you get 0/0 = 8/9? So 3 is not actually a solution of that equation! (It would be called extraneous.) And it isn’t obvious that it is a solution of the actual problem, until you check it in the original problem. The real problem arises earlier than that: The equation doesn’t really represent the problem. I generally tell students to check their answer, not by plugging it into their equation, but by checking if it works in the problem itself. When the equation is wrong, this will catch it. But here, the equation turns out to be wrong but our answer is correct! So how do you check the solution? You have go back to the problem: Let P(x,0), Q(3,x2), P1(2x,1), and Q1(6,x2). Find all possible values of x ∈ R such that PQ || P1Q1. If x=3, the points are P(3,0), Q(3,9), P1(6,1), and Q1(6,9), and the vectors are PQ = <0,9>, P1Q1 = <0,8>. Are they parallel? Yes, because both are vertical — a case not covered by your equation! That is the ultimate cause of your difficulty. This is what I’d found graphically (for $$x=3$$), which made me look again: So, how can we solve the problem without making the unintentional assumption that the vectors are not vertical? ### Back to square one: What really makes parallel vectors parallel? What you never wrote, at the start, was what defines parallel vectors. I asked, “What fact are you using to justify the equation?”, and I’d still like an answer: What perspective were you taking on parallelism when you wrote that equation? What have you been taught about the meaning of “parallel”? Two vectors are parallel if one is a scalar multiple of the other. In two dimensions, <a,b> and <c,d> are parallel if there is a non-zero scalar k such that <c,d> = k<a,b>; i.e. c = ka and d = kb. You have translated this to c/a = d/b = k; but that assumes that a and b are both non-zero. If you use this form, you need to separately check the contrary case. Equivalently, one could take vectors to be parallel if their direction angles are the same, and then compare the tangents of those angles (their slopes): b/a = d/c. But those don’t exist for vertical vectors. If you do that, you need to separately consider the latter possibility. His proportion was$$\frac{6-2x}{3-x}=\frac{x^2-1}{x^2}.$$So, using his form, my “c/a = d/b”, you need to ask what happens when a denominator is zero, namely $$3-x=0$$ or $$x^2=0$$. The former leads to our missing solution. If you used the “b/a=d/c” form, representing equal slopes,$$\frac{x^2}{3-x}=\frac{x^2-1}{6-2x},$$you’d need to check when these denominators are zero, and in this case both are zero for $$x=3$$ (that is, both vectors are vertical). So if I were doing this carefully, I would not have started with the equality of two fractions, but with the definition using scalar multiplication: PQ = <3-x,x2> P1Q1 = <6-2x,x2-1> These are parallel if P1Q1 = kPQ, so that 6-2x = k(3-x) x2-1 = kx2 From the first equation, either k = (6-2x)/(3-x) = 2, or x = 3. If k = 2, the second equation implies that x2 = -1, which is impossible. If x = 3, then PQ = <0,9> and P1Q1 = <0,8>, and these are indeed parallel, with k = 8/9. The solution of that first equation would look like this, done carefully:$$6-2x = k(3-x)\\2(3-x)-k(3-x)=0\$$2-k)(3-x)=0\\k=2\text{ or }x=3 Or I might eliminate k from the equations by writing your rational equation, while keeping in mind that in dividing by x2 and by x-3, I was assuming both are non-zero, and check those cases. If we check the case \(x^2=0$$, we find that $$\overrightarrow{PQ}=\left\langle3,0\right\rangle-\left\langle 0,0\right\rangle=\left\langle3,0\right\rangle$$ and $$\overrightarrow{P_1Q_1}=\left\langle 6,0\right\rangle-\left\langle0,1\right\rangle=\left\langle6,-1\right\rangle$$. These are not parallel.

Merely recognizing that your equation does not allow x = 3, and checking that separately, would also be valid, though it’s better to understand why. Just solving without canceling, as you have now done, is less appropriate, but it does lead to the answer (as long as you check it).

This is a very interesting problem, isn’t it?

Brine closed it out:

Yes you are right. I was actually taught that parallel vectors are parallel if they have a k value such that a=kb (where a and b are vectors) I forgot to apply this rule because in grade 12 I was taught by equaling the two slopes if they are parallel. I did learn the other method in the previous grade too but I forgot and I do remember it. The way you showed is way better that the one I did. Thank you so much for teaching me Dr. Peterson!

Sometimes we learn a shortcut method, or transfer it from one topic to another, and neglect to pay attention to conditions that are attached to them. It’s a good lesson!

This site uses Akismet to reduce spam. Learn how your comment data is processed.