Prove $\forall n > 2, \ \exists p\in \Bbb{P} : n < p < n!$

I need to prove that:

$$(1) \ \forall n\in\Bbb{N}_{\ge2}, \ \exists p\in \Bbb{P} : n < p < n!$$

I already know how to prove the $n < p$ part; it directly follows from the proof that there is no largest prime. However, I am stumped on the $p < n!$ part.

One idea I had for showing this is as follows: we know that $(2) \ \forall n \in \Bbb{N}_{\ge2},\ \exists m\in\Bbb{N} : n!=2m$. By testing a few values, I conjectured that $(3) \ \forall n\in\Bbb{N}_{\ge2}, \ \exists p\in \Bbb{P} : n < p < 2n$. If (3) could be shown, it would be simple to prove (1), but there does not seem to be no easy way to prove (3), if it's even correct.

• "that there is always a prime number between $n$ and $2n$" The names Bertrand and Chebyshev spring to mind. – Daniel Fischer Jul 26 '13 at 14:32
• Oh, wow! I didn't know that! I was just trying to find a 'lazy' solution. But it's nice to know. :) – dotslash Jul 26 '13 at 14:33
• There's also an easy direct way. Do you know Euclid's proof that there are infinitely many primes? – Daniel Fischer Jul 26 '13 at 14:35
• Yes, I do. But not sure how to use it here. – dotslash Jul 26 '13 at 14:36
• I was thinking of what Goos answered. That relieves of the burden of proving that the product of primes $< n$ is $> n$ (although that's not very hard). – Daniel Fischer Jul 26 '13 at 14:40

Just consider $n! - 1$. Clearly this is between $n$ and $n!$ as long as there is anything between $n$ and $n!$, and it isn't divisible by any prime $p \le n$. Thus it contains a prime factor bigger than $n$ and smaller than $n!$.

• Correct me if I'm wrong, but $n! -1$ isn't divisible by any prime less than $n$ because all the primes are already included in $n!$ ? – dotslash Jul 26 '13 at 14:53
• @dotslash For any prime $p \le n$, $p$ is contained in the product $n!$, so $n! - 1$ is one less than a multiple of $p$. – 6005 Jul 26 '13 at 14:55
• Precisely my thinking! Thank you for the concise and beautiful answer! – dotslash Jul 26 '13 at 14:59

You can obviously proceed by stating the Bertrand's postulate. However, I think the question is asking you to solve it a bit differently.

Let us solve it using a method similar to that used by Euclid when he tried to prove that there are infinite number of primes. Let $p_{1},p_{2},\cdots ,p_{k}$ be all the primes less than or equal to $n$. Obviously, $k<n$.Let, $P=p_{1}\times p_{2}\times\cdots \times p_{k}+1$.

Notice that $P$ is not divisible by any of the given primes. Hence $P$ is either a prime or is divisible by a prime $> n$.

It can be easily seen that $$P<n!$$ Furthermore, $P$ needs to be greater than $n$, otherwise we would find another prime (other than $p_{1},p_{2},\cdots,p_{k}$) which would lead to a contradiction.

• I think you mean that $p_1, p_2, \cdots , p_k$ are less than or equal to $n$. You also have to be careful when claiming that $P < n!$; this isn't true in the case $n = 3$. – 6005 Jul 26 '13 at 14:42
• You need it to not be divisible by $n$ if $n$ is prime, so you need to include primes less than or equal to $n$ in the product. Thus you get $3*2 + 1 = 7$, not less than $3! = 6$. – 6005 Jul 26 '13 at 14:47
• Sorry!My bad,I guess the case n=3 has to be checked manually.Other than that I think there are no exceptions. – Shaswata Jul 26 '13 at 14:49

What you speculate on is correct, there is always a prime between $n$ and $2n$. This is known as Bertrand's postulate and is really a theorem. But for between $n$ and $n!$ you can modify the Euclid proof for a much easier approach. It is true for $3, 3 \lt 5 \lt 6$. For $n \gt 3,$ take the product of all primes less than $n$ and add $1$. This is less than $n!$ because it has only one factor of $2$, not the three coming from $2$ and $4$. Then it is either prime or composite ...

• Great! But your explanation of "only one factor of $2$" confuses me. Isn't it simpler to say that $n!$ contains all the integers between $2$ and $n$, including those that are prime. Hence, $n! > p$? – dotslash Jul 26 '13 at 14:46
• But we need a prime greater than $n$ and $n!$ doesn't contain that as a factor. I wanted to justify that the product of all the primes less than $n$ is strictly less than $n!$ so that I could add one and still be less. Identifying a factor of $n!$ that is not part of the product of primes was my way of doing that. That is also why I did $3$ separately-it is not true in that case as you can see. If we just take all the primes less than or equal to $3$, the product plus $1$ is $7$ and we have not found a prime between $3$ and $3!$ – Ross Millikan Jul 26 '13 at 15:10
• I follow you now. Thanks for the answer! – dotslash Jul 26 '13 at 15:42


# Why is $\gcd(a,b)=\gcd(b,r)$ when $a = qb + r$?

Given: $a = qb + r$

Then it holds that $\gcd(a,b)=\gcd(b,r)$. That doesn't sound logical to me. Why is this so?

Addendum by LePressentiment on 11/29/2013: (in the interest of http://meta.math.stackexchange.com/a/4110/53259 and averting a duplicate)

What's the intuition behind this result? I only recognise the proof and examples solely due to algebraic properties and formal definitions; I'd like to apprehend the result naturally.

-
$a$, $b$, $r$ are integers? (If yes, tagging the question elementary-number-theory would be suitable.) Or are you looking for some greater generality, e.g. they are elements of some type of commutative ring? If yes, you should say so and you should also mention, what are the assumptions about this ring. –  Martin Sleziak Jan 2 '12 at 13:12
If you're asking about integers, then this question is very similar to yours: math.stackexchange.com/questions/59147/… –  Martin Sleziak Jan 2 '12 at 13:16
see page 13 here www-groups.dcs.st-and.ac.uk/~martyn/teaching/1003/… –  Bhargav Jan 2 '12 at 13:26
@Martin The result does not depend upon the underlying ring (assuming $\rm\:gcd(a,b)\:$ exists). –  Bill Dubuque Jan 2 '12 at 18:19

If $d$ is a divisor of $a$ and of $b$, then \begin{align} a & = dn, \\ b & = dm. \end{align} So $$a-b= dn-dm=d(n-m)= (d\cdot\text{something}).$$ So $d$ is a divisor of $a-b$.

Thus: All divisors that $a$ and $b$ have in common are divisors of $a-b$.

If $d$ is a divisor of $a$ and of $a-b$, then \begin{align} a & = dn, \\ a-b & = d\ell. \end{align} So $$b=a-(a-b)=dn-d\ell=(d\cdot\text{something}).$$ So $d$ is a divisor of $b$.

Thus: All divisors that $a$ and $a-b$ have in common are divisors of $b$.

Therefore, the set of all common divisors of $a$ and $b$ is the same as the set of all common divisors of $a$ and $a-b$.

Subtracting one member of a pair from the other never alters the set of all common divisors; therefore it never alters the $\gcd$.

-
Very clear answer! Little remark: $a-b \neq r$, but $a-qb = r$, but all your explanation will work using that :). –  Kevin Jan 2 '12 at 21:17
@Kevin Beware that this fails if the ring is not $\rm\:\mathbb Z\:$ since then the remainder $\rm\:r\:$ generally cannot be obtained by repeatedly subtracting $\rm\:b\:$ from $\rm\ q\ b + r\:,\:$ as it can when $\rm\:q\in\mathbb N\:.\:$ In other words, in general Euclidean rings, e.g. the polynomial ring $\rm\:F[x]\:$ over a field $\rm\:F\:,\:$ the Euclidean algorithm generally requires division with remainder, not simply iterated subtraction, in order to effect descent to a "smaller" remainder. So this ad-hoc special-case doesn't generally reveal the essence of the matter. –  Bill Dubuque Jan 2 '12 at 22:37
@Kevin : Thanks; I've fixed the typo. –  Michael Hardy Jan 3 '12 at 0:52
To express Bill Dubuque's point in other way: Euclid's algorithm works for polynomials, but the argument I give in my answer doesn't work for polynomials unless you do some adaptations. –  Michael Hardy Jan 3 '12 at 0:53

HINT $\rm\ \$ If $\rm\ d\ |\ b\$ then $\rm\ d\ |\ q\ b + r\ \iff\ d\ |\ r\:.\$ Therefore $\rm\ \{b\:,\:q\ b+r\}\$ and $\rm\ \{b\:,\: r\}\$ have the same set of common divisors $\rm\:d\:,\:$ hence they have the same greatest common divisor.

Modly: $\$ if $\rm\ b\equiv 0\$ then $\rm\ q\ b+r\equiv 0\: \iff\: r\equiv 0\ \pmod{d}$

NOTE $\$ The result holds true because $\rm\:\mathbb Z\:$ forms a subring of its fraction field $\rm\:\mathbb Q\:.\:$ More generally, given any subring $\rm\:Z\:$ of a field $\rm\:F\:$ we define divisibility relative to $\rm\ Z\$ by $\rm\ x\ |\ y\ \iff\ y/x\in Z\:.\:$ Then the above proof still works, since if $\rm\ q,\ b/d\ \in Z\$ then $\rm\ q\:(b/d) + r/d\in Z\ \iff\ r/d\in Z\:.\:$ In other words, the usual divisibility laws follow from the fact that rings are closed under the operations of subtraction and multiplication; being so closed, $\rm\:Z\:$ serves as a ring of "integers" for divisibility tests.

For example, to focus on the prime $2$ we can ignore all odd primes and define a divisibility relation so that $\rm\ m\ |\ n\$ if the power of $2$ in $\rm\:m\:$ is $\le$ that in $\rm\:n\:$ or, equivalently if $\rm\ n/m\$ has odd denominator in lowest terms. The set of all such fractions forms a ring $\rm\:Z\:$ of $2$-integral fractions. Moreover, this ring enjoys parity, so arguments based upon even/odd arithmetic go through. Similar ideas lead to powerful local-global techniques of reducing divisibility problems from complicated "global" rings to simpler "local" rings, where divisibility is decided by simply comparing powers of a prime.

-

You can show that for any integer $d$, we have $d\; |\; a$ and $d\; |\; b$ if and only if $d\; |\; b$ and $d\; |\; r$. In other words, $a$ and $b$ have exactly the same common divisors as $b$ and $r$. Thus $\gcd(a,b)$ is the same as $\gcd(b,r)$.

-
excellent answer, +1 for it. –  ncmathsadist Jan 2 '12 at 13:44
Thanks, but why do they have the same common divisors? –  Kevin Jan 2 '12 at 21:15
@Kevin: If $d$ divides $a$ and $b$, then $d$ divides $-qb$ and thus divides the sum $a - qb = r$. This shows that any common divisor of $a$ and $b$ is a common divisor of $b$ and $r$. If $d$ divides $b$ and $r$, then $d$ divides $qb$ and thus divides the sum $qb + r$. This shows that any common divisor of $b$ and $r$ is a common divisor of $a$ and $b$. –  Mikko Korhonen Jan 2 '12 at 21:52

Since set of common divisors of $a-b$ and $b$ coincides with the set of common divisors of $a$ and $b$ then $\operatorname{gcd}(a,b)=\operatorname{gcd}(a-b,b)$. If $a=qb+r$, where $b>0$ and $0\leq r<b$, you can apply this equality $q$ times and obtain $\operatorname{gcd}(a,b)=\operatorname{gcd}(r,b)$

-
But $a-b$ and $b$ don't have the same set of divisors. They have the same set of common divisors with $a$. –  Peter Taylor Jan 2 '12 at 14:29
Ok common divisors. I always miss some details. –  no identity Jan 2 '12 at 14:40
@Norbert : what you must have meant is that $\{a,b\}$ and $\{a-b,b\}$ have the same set of common divisors. –  Michael Hardy Jan 2 '12 at 18:01
Yes, this is what I meant. –  no identity Jan 2 '12 at 18:17
Beware that this "repeated subtraction" implementation of division with remainder does not generally yield the Euclidean algorithm in other domains, e.g. for polynomials. See my comment to Hardy's answer. –  Bill Dubuque Jan 2 '12 at 22:58

Let $A$ be a commutative ring. For any $a_1,\dots,a_n$ in $A$ let $(a_1,\dots,a_n)$ the ideal generated by the $a_i$.

Then, for any $q,b,r$ in $A$, we have $$(qb+r,b)=(b,r).$$ Indeed, $qb+r$ is in $(b,r)$, and $r$ is in $(qb+r,b)$.

EDIT. Dear Kevin: Your question, I think, would be better understood if put in a wider context, involving rings and ideals. The most basic fact behind the question is, I believe, the fact that, in any commutative ring, the elements $qb+r$ and $b$ generate the same ideal as the elements $b$ and $r$. If you make additional hypothesis, this fact can be interpreted in terms of divisibility. (See Bill's comment.) The simplest is to assume that your ring is a principal ideal domain.

I could try to explain this in greater details, but many mathematicians much better than I have already done that. So, my advice would be to take a look at at least one of the many Algebra textbooks written by great mathematicians. Here are some of these books:

-
This seems to implicitly assume some relation between gcds and ideals, e.g. for Bezout domains $\rm\ (a,b) = (\gcd(a,b))\:.$ –  Bill Dubuque Jan 2 '12 at 22:28
Dear @Bill: Thanks for your comment. I edited the answer. (Of course, I agree with you.) –  Pierre-Yves Gaillard Jan 3 '12 at 5:50
Divisor theory gives one nice way to better understand the relations between ideals and gcds. For a brief overview see Friedemann Lucius, Rings with a theory of greatest common divisors and for a longer exposition see Olaf Neumann, Was sollen und was sind Divisoren? (What are divisors and what are they good for?), Math. Semesterber, 48, 2, 139-192 (2001). –  Bill Dubuque Jan 3 '12 at 6:38

I'm going to use the notation $(a,b)$ for the GCD of $a$ and $b$.

If $d|a$ and $d | b$ then $d|(a,b)$, by the definition of GCD. (Well, by one common definition...if that's not the definition you learned, then you probably learned it as a theorem).

Since $(a,b)|a$ and $(a,b)|b$, by the definition of $(a,b)$, it divides $a-qb$, so we have $(a,b)|r$. This gives us $(a,b)|b$ and $(a,b)|r$, hence $(a,b)|(b,r)$.

Now let's go the other way. $(b,r)|b$ and $(b,r)|b$, both by definition, so it also divides $r+qb$, giving us $(b,r)|a$. That gives is $(b,r)|(a,b)$.

From $(a,b)|(b,r)$ and $(b,r)|(a,b)$, we get $(a,b)=(b,r)$ or $(a,b)=-(b,r)$. The latter can be eliminated because GCD is by definition greater than 0.

-

a,b q ,r are integers how can we say that HCF(a,b) = HCF (b,r) we can say common divisor of a and b = common divisor of b and r. for example hcf of 4 and 2 = 2 4= 2x2 + o but here HCF of 4 and2 =2 but HCF of 2 and 0 =1 so how can we say that HCF(a,b) = HCF (b,r)

-

Theorem: Let $a > b > 0$ with $a = bq + r$, $0\leq{}r<b$ then $\gcd(a;b) = \gcd(b;r)$.

Proof: Need to show that $C(a;b) = C(b;r)$ for then the result will hold. To show that the two sets are equal requires showing that $C(a;b) \subseteq C(b;r)$ and that $C(b;r) \subseteq C(a;b)$:

Let $y \in C(a;b)$ thus $y|a$ and $y|b$,
then $y|[a+(-q)b]$,
and so $y|r$, since $r=a-bq$,
but since $y|b$ is also true, we now have that $y \in C(b;r)$, finally this means that $C(a;b) \subseteq C(b;r)$.

Now let $y \in C(b;r)$ thus $y|b$ and $y|r$,
then $y|[(q)b+r]$,
and so $y|a$, since $a=bq+r$,
but since $y|b$ is also true, we now have that $y \in C(a;b)$, finally this means that $C(b;r) \subseteq C(a;b)$.

Therefore the required results have been proven.

Note: Where $C(a;b)$ denotes the set of common divisors/factors of $a$ and $b$, that is: $C(a;b)=\{y: y|a \land y|b\}$

-


Here is a very simple table showing data lined up in columns. Example. We will look at how to do this using an example and then also look at how to answer questions about a data set using a two way table. 3 Some Table Examples Example-1: A table with combined columns is given below. Practice your multiplication tables. Syntax of this Tableau ABS Function is: ABS(number) To demonstrate these Tableau math functions, we use Calculated Fields. Add rows, call Compute and Merge, and set PrimaryKey. Tree Diagrams in Math: Definition & Examples 4:43 Truth Table: Definition, Rules & Examples 6:08 6:52 Notice that I include the table in a center'' environment to display it properly. The table results can usually be used to plot results on a graph. Illustrated definition of Table: Information (such as numbers and descriptions) arranged in rows and columns. Size of the preallocated table, specified as a two-element numeric vector. According to the survey, what is the probability that a male likes rap music? The game element in the times tables games make it even more fun learn. A truth table is a handy little logical device that shows up not only in mathematics but also in Computer Science and Philosophy, making it an awesome interdisciplinary tool. \multicolumn{num}{col}{text} command is used to combine the following num columns into a single column with their total width. What is. The results, separated by gender, are displayed above. This is an example of a blank math lesson plan where you can fill out the pertinent information in the blank space provided, such as the lesson title, unit title, lesson number, class level, duration of the lessons, number of classes, teacher, lesson objectives, standards, essential questions, and evidence of learning. Example Example The table shows the math achievement test scores for a random sample of n = 10 college freshmen, along with their final calculus grades. Notes. Table Data - Basic Example A total of 72 people participated in a survey about their music preferences. Answer: 0.9332 To find the answer using the Z-table, find where the row for 1.5 intersects with the column for 0.00; this value is 0.9332.The Z-table shows only “less than” probabilities so it gives you exactly what you need for this question. Sample Questions Header Block Open sample questions menu Math . Cap table math is confusing. Use these sample z-score math problems to help you learn the z-score formula. Loved by kids and parent worldwide. The idea is to convert the word-statement to a symbolic statement, then use logical equivalences as we did in the last example. There are four variables in the JavaScript block. 22 Examples of Mathematics in Everyday Life. The following table summarizes them: As math requires special environments, there are naturally the appropriate environment names you can use in the standard way. Example example the table shows the math achievement. Times Tables. You read it right; basic mathematical concepts are followed all the time. The title is created simply as another paragraph in the center environment, rather than as part of the table itself. Hope this helps! So now how many people can we fit? Logic. The following HTML example contains the HTML, CSS, and JavaScript necessary to build a dynamic HTML table. Learn the multiplication tables in an interactive way with the free math multiplication learning games for 2rd, 3th, 4th and 5th grade. \begin{center} Numbers of Computers on Earth Sciences Network, By Type. Yes! Some of the times tables are illustrated below: Times Table … Consumer Math. For example, in the table shown below, Jacket is listed twice in column A. To complete a two way table for a set of data, you need to determine the variables of interest, their possible values, and then finally, the frequencies. But, maths is the universal language which is applied in almost every aspect of life. Go to First Question . Aligned to Common Core. The answer obtained in every step is a multiple of 2 and is known as multiplication fact. The opposite of a tautology is a contradiction or a fallacy, which is "always false". Tableau Math Functions. Skip to main content. Try the free Mathway calculator and problem solver below to practice various math topics. View sample math questions and directions students will encounter on SAT test day. The argument col contains one of the position symbols, l, r, or c. The argument text contains the content of the column. The following examples will show you the list of Math Functions in Tableau. Because complex Boolean statements can get tricky to think about, we can create a truth table to keep track of what truth values for the simple statements make the complex statement true and false. Example. Tally Table - Definition with Examples. There's now 3 parts to the tutorial with two extra example videos at the end. Trusted by teachers across schools. Possible values will be from 1-10, instead of 0-9. Uploaded By BrigadierIronJay8680. Example. Truth Table. Determining the post-money cap table for an equity round with an option pool refresh and one or more convertible notes converting to equity can be overwhelming. Here you can find additional information about practicing multiplication tables at primary school. Comprehensive Curriculum. According to some people, maths is just the use of complicated formulas and calculations which won’t be ever applied in real life. There are two disadvantages of writing tables by hand as described in this tutorial. Most of the time the data will be collected in form of a spreadsheet and we don't want to enter the data twice. Tables. Example: table([1:3]',{'one';'two';'three'},categorical({'A';'B';'C'})) creates a table from variables with three rows, but different data types. Mathematics for the Liberal Arts. Example. A math function table is a table used to plot possible outcomes of a function, which is a kind of rule. Reading over the table; Exercising using the Math Trainer; But here are some "tips" to help you even more: Tip 1: Order Does Not Matter. Go to next Question. Back to overview Forward to Shortdocumentation 1 Examples of Latex Here an example of a very small Latex document \documentclass{article} \begin{document} example for a very \tiny{tiny} \normalsize \LaTeX \ document \end{document} Truth Tables . For example, in the example given below, 7 … A tautology in math (and logic) is a compound statement (premise and conclusion) that always produces truth. Roman numerals.. my mind ~ my math .. Tables/Graphs/Charts BEST CHART EVER !!! Unlike most other environments, however, there are some handy shorthands for declaring your formulas. Two way tables, also known as contingency tables, show frequencies (counts) as they relate to two variables. Some math sections allow the use of a calculator, others do not. By Grades. Mathematical tables are lists of numbers showing the results of a calculation with varying arguments.Tables of trigonometric functions were used in ancient Greece and India for applications to astronomy and celestial navigation.They continued to be widely used until electronic calculators became cheap and plentiful, in order to simplify and drastically speed up computation. Construct a truth table for the formula . The Tableau ABS function is used to return the absolute positive value. This tutorial provides you with commonly used SQL math functions that allow you to perform business and engineering calculations. This is more typical of what you'll need to do in mathematics. 50,000 Schools . Another Example: 2×9=18, and 9×2=18. The Complete K-5 Math Learning Program Built for Your Child. For instance, if we want to work out the times table for 2, we start with 2 and then add 2 in each step. A function table in math is a table that describes a function by displaying inputs and corresponding outputs in tabular form. HTML tables allow web developers to arrange data into rows and columns. About the book: I am honored to see my latest book, Table Talk Math, published by Dave Burgess Consulting and available on Amazon.In it, math educators and experts from around the world offer ideas and share stories about ways in which parents can engage their children with a math-based conversation in an easy-to-read format and plenty of examples. In some tables, there might not be unique values any column in the lookup table. The notation may vary… 30 Million Kids. To fully understand function tables and their purpose, you need to understand functions, and how they relate to variables. However, there is only one record for each jacket and size combination -- Jacket Medium in row 4 and Jacket Large in row 5. Extras. No matter what the individual parts are, the result is a true statement; a tautology is always true. C# DataTable Examples Store data in memory with a DataTable. SAT Suite of Assessments Sample Questions. We can fit one, two, three, four, five. (See Commutative Property.) Tables, graphs, and charts are an easy way to clearly show your data. A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, boolean functions, and propositional calculus—which sets out the functional values of logical expressions on each of their functional arguments, that is, for each combination of values taken by their logical variables. Let's see. sz — Size of preallocated table two-element numeric vector. A times table is a list of multiples of a number. Be sure to consider how to best show your results with appropriate graph forms. School St. John's University; Course Title MTH 1250C; Type. First, I list all the alternatives for P and Q. Search for: Truth Tables and Analyzing Arguments: Examples. Tableau ABS Function. And then on this table, which is identical, you could fit six, seven, eight, nine. Z Score Table Sample Problems. When we multiply two numbers, it does not matter which is first or second, the answer is always the same. Parents, Sign Up for Free Teachers, Sign Up for Free. Logic Symbols in Math; Truth Table; Tautology Math Examples; Tautology Definition. Pages 47. Example: 3×5=15, and 5×3=15. Math.floor(Math.random() * (max - min + 1)) + min // We can introduce a min variable as well so we can have a range. While it works for small tables similar to the one in our example, it can take a long time to enter a large amount of data by hand. This preview shows page 11 - 23 out of 47 pages. So here we have one table, and it's going to touch ends with this table right over here. And because it touches ends right over here-- we're making it one big continuous table-- you can't fit someone here anymore.

## table math example

Zapp's Chips Careers, Enchanted Sword Seed, Emmer Wheat Vs Wheat, Momeni Koi Area Rugs, Best Garlic Mayonnaise, 1965 Impala 4 Door For Sale, Deer Resistant Honeysuckle, Steakhouse Blue Cheese Dressing Recipe, Drama Genre Examples,


# How can one show that $\sum_{n=0}^\infty\frac{n}{n!}=e$? [duplicate]

How can one show that $$\sum_{n=0}^\infty\frac{n}{n!}=e$$?

I understand that $$\sum_{n=0}^\infty\frac{x^n}{n!}=e^x$$ and that letting $$x=1$$would give $$\sum_{n=0}^\infty\frac{1}{n!}=e$$

But why does the sum $$\sum_{n=0}^\infty\frac{n}{n!}$$ give an answer of $$e$$ also?

• In the picture on the bottom sum the numerator should be n, apologies. – user677704 Jun 1 '19 at 2:51
• Are you familiar with derivatives ? – DanielV Jun 1 '19 at 2:53
• Your question is rather unclear. Do you want to prove: $\sum _{n=0}^{\infty }\:\frac{x}{n!}=e?$ – NoChance Jun 1 '19 at 3:12
• ‘No chance’ yes that was my question more or less, I just didn’t understand why different sums all add to e – user677704 Jun 1 '19 at 3:13
• It can be proven that $\sum _{n=0}^{\infty }\:\frac{x^n}{n!}=e^x$. However, in your expression, you don't raise x to the power n. – NoChance Jun 1 '19 at 3:15

Note that $$n/n!=1/(n-1)!$$, which is not meaningfully distinct in the context of the infinite sum from the terms $$1/n!$$.

In fact $$\sum_{n\geq 0} \frac{n}{n!}\stackrel{(1)}{=}\sum_{n\geq 1} \frac{n}{n!}= \sum_{n\geq 1} \frac{1}{(n-1)!}\stackrel{(2)}{=}\sum_{n\geq 0} \frac{1}{n!}=e^1=e$$ (1) comes from the fact that the first term is zero, (2) is a shift of indices by one.

You can repeat this shifting procedure ad infinitum and obtain, for each fixed $$k$$ $$\sum_{n\geq 0} \frac{n(n-1)\ldots (n-k)}{n!}=e$$ because your sum 'starts' at index $$k+1$$.

• This is what I meant in my answer. Nice presentation. +1 – The Count Jun 1 '19 at 3:14
• So I, in fact, unfolded your idea ? (+1) – Duchamp Gérard H. E. Jun 1 '19 at 3:15
• Teamwork! I like it. – The Count Jun 1 '19 at 3:16

$$\begin{array} {rcl} % \displaystyle e^x & = & \displaystyle \sum_{n = 0}^{\infty} \frac{x^n}{n!} \\ % \displaystyle\frac{d}{dx}e^x & = & \displaystyle \frac{d}{dx}\sum_{n = 0}^{\infty} \frac{x^n}{n!} \\ % e^x & = & \displaystyle \sum_{n = 0}^{\infty} \frac{nx^{n-1}}{n!} \\ % e^1 & = & \displaystyle \sum_{n = 0}^{\infty} \frac{n1^{n-1}}{n!} \\ \end{array}$$

• Thanks for your response it’s really clear and perfectly understood, I appreciate it. So would I be right in assuming you can repeat this process ad infinitum and acquire many different expressions which all sum to e? – user677704 Jun 1 '19 at 3:15
• Yes, in this case the multipliers will be $$n,n(n-1),n(n-1)(n-2),\ldots$$ and so on ... – Duchamp Gérard H. E. Jun 1 '19 at 3:18
• That’s incredibly interesting, aside from showing this with basic differentiation would you know where to find a geometric or more intuitive proof. The logic is perfectly reasonable but I prefer to see why. – user677704 Jun 1 '19 at 3:25
• @User3457884334 I added repetition of this process ad infinitum in my answer. – Duchamp Gérard H. E. Jun 1 '19 at 3:26
• I understand that but wondered if there was another proof to show it geometrically. – user677704 Jun 1 '19 at 3:28

Suppose $$e^x=a_0+a_1x+a_2x^2+a_3x^3+...$$ try to find the constants by evaluating $$e^0$$ and then differentiating to eliminate the current $$0$$th degree term.

Here are the first three terms : $$e^0=a_0+a_1*0+...=1\Leftrightarrow a_0=1$$ $$\frac{d}{dx}(e^x)=e^x=\frac{d}{dx}(a_0+a_1x+a_2x^2+...)=a_1+2a_2x+3a_3x^2+...$$ $$e^0=a_1+2a_2*0+3a_3*0^2+...=1\Leftrightarrow a_1=1$$ $$\frac{d}{dx}(e^x)=e^x=\frac{d}{dx}(a_1+2a_2x+3a_3x^2+...)=2a_2+(3*2)a_3x+...$$ $$e^0=2a_2+(3*2)a_3*0\,+...=1\Leftrightarrow a_1=\frac{1}{2}$$ You'll find that $$e^x=\sum_{n=0}^\infty \frac{x^n}{n!}$$ switch $$1$$ for $$x$$ and you get your result (refer to The Count's answer).

Differentiate the series $$e^x=\sum_{n=0}^{\infty}\dfrac {x^n}{n!}$$ term by term. Get $$\sum_{n=0}^{\infty}\dfrac {nx^{n-1}}{n!}$$. Then set $$x=1$$. Note that $$(e^x)'=e^x$$ (for$$\sum_{n=0}^{\infty}\dfrac {nx^{n-1}}{n!}=\sum_{n=0}^{\infty}\dfrac {x^n}{n!}$$) .


# Find the number of distributions of seven distinct balls into three distinct boxes if at least two balls must go into each box.

My Answer: I chose to place three balls into one box and two balls in the other two boxes. This can be done three times: $$\binom73\binom42\binom22=\binom{7}{3,2,2}\\ \binom72\binom53\binom22=\binom{7}{2,3,2} \\ \binom72\binom52\binom33=\binom{7}{2,2,3}$$ I'm not sure if this is correct, but we have not covered Stirling numbers yet, so I cannot use that as my explanation. Please help and thank you!

An alternative method, noting that 2/2/3 is the only distribution of seven balls to three boxes with at least two balls in each box:

• 3 choices for the box with three balls
• $\binom73=35$ ways to put three balls into that box
• $\binom42=6$ ways to put two balls into one of the remaining boxes; the third box is then forced to contain the last two balls

This yields $3\cdot35\cdot6=630$ possibilities, and your approach yields the same result but through a longer process.

• Of course the solution appear to be the same once one recognises that the three numbers in the OP's solution must be the same by symmetry. – Carsten S Jul 15 '17 at 11:38

Your answer is correct. Here is a variation based upon exponential generating functions.

• A selection of at least two distinct balls can be encoded as \begin{align*} \frac{x^2}{2!}+\frac{x^3}{3!}+\cdots=e^x-1-x \end{align*}

• Since we have three boxes we consider \begin{align*} (e^x-1-x)^3\tag{1} \end{align*}

We denote with $[x^n]$ the coefficient of $x^n$ in a series.

Since we are looking for the number of placing $7$ distinct balls we consider the coefficient of $x^7$ in (1) and obtain with some help of Wolfram Alpha

\begin{align*} 7![x^7](e^x-1-x)^3=\color{blue}{630} \end{align*}

• Let's say we have a red box, a blue box, and a green box (and the observer is not colorblind). There are $\binom{7}{3}$ ways of placing three balls in the red box, $\binom{4}{2}$ ways of placing two of the remaining four balls in the blue box, and $\binom{2}{2}$ ways of placing the remaining two balls in the green box. Hence, there are $$\binom{7}{3}\binom{4}{2}\binom{2}{2} = \binom{7}{3, 2, 2}$$ ways to distribute the balls so that three are placed in the red box, two are placed in the blue box, and two are placed in the blue box. By symmetry, the answer is $$3\binom{7}{3, 2, 2}$$ – N. F. Taussig Jul 19 '17 at 12:31
• @N.F.Taussig: Thanks for your hint! – Markus Scheuer Jul 19 '17 at 12:38
• @N.F.Taussig: I was misleading by myself. Original answer restored. – Markus Scheuer Jul 19 '17 at 16:58
• I have written a solution based on your idea of first placing the seven distinguishable ways in three indistinguishable boxes, then arranging the boxes. – N. F. Taussig Jul 19 '17 at 19:16

This solution is a modification of an attempted solution that Markus Scheuer deleted.

First, we count the number of ways seven distinguishable balls can be placed in three indistinguishable boxes if at least two balls are placed in each box. Then we will arrange the boxes.

The only permissible way to distribute the balls is to place three balls in one bag and two each in the other bags.

Method 1: There are $\binom{7}{3}$ ways to select three balls to be placed in one of the boxes. Line up the remaining balls in a row. Take the ball at the left end of the row and place it in an empty box. There are three ways of selecting one of the other three balls to be placed in the same box as that ball. The remaining two balls must be placed in the remaining empty box. Hence, there are $$3\binom{7}{3}$$ ways to place seven distinguishable balls in three indistinguishable boxes.

Method 2: There are $\binom{7}{3}$ ways to place three of the balls in one box. That leaves $\binom{4}{2}$ ways to place two of the remaining four balls in another box. The remaining two balls are place in the third box. That suggests the answer is $$\binom{7}{3}\binom{4}{2}$$ However, since the boxes are indistinguishable, we cannot distinguish between the two boxes that received two balls. Thus, we must multiply the above result by $1/2$. Hence, there are $$\frac{1}{2}\binom{7}{3}\binom{4}{2}$$ ways of distributing seven distinguishable balls to three indistinguishable boxes.

To make the boxes distinguishable, we paint one box blue, one box green, and one box red. There are $3!$ ways to do this. Hence, there are $$3! \cdot 3\binom{7}{3} = 630$$ ways to place seven distinguishable balls in three distinguishable boxes if at least two balls must be placed in each box.

• @NFTaussig: Clear and extensive elaboration. Very nice! (+1) – Markus Scheuer Jul 19 '17 at 19:38


# Probability of picking matching socks, after partitioning the drawer.

Apologies if this is a duplicate. I searched and didn't find anything quite like it.

Suppose I have a drawer with an equal number of N black socks and N white socks. They're all mixed up. So, my chances of picking a matching pair in the first two selections is (N-1)/(2N-1), right? Well, what if, before I pick the first sock, I randomly (so I don't know the colors of the socks I'm moving) partition the drawer so that there are N socks on each side, and I draw one sock from each side. Do the chances of drawing a matching pair change?

On the one hand, we can see that selection from one side doesn't change the composition of socks on the other side of the partition. However, whichever color I choose from the "first" side, it's likely that there are more of that color on that side. On other words, if I draw a black sock from one side, it's more likely that that side had N-1 blacks and 1 white than it is that that side had 1 black and N-1 whites.

My suspicion is that I need to do some kind of hypothesis testing, where I consider the chances of every possible partitioning, but that's way above my skill level.

• Shouldn't the probability in the simple case be $\frac{N-1}{2N-1}$, because there are no longer $2N$ socks in the drawer? Feb 19 '18 at 20:17
• with replacement? Feb 19 '18 at 20:18
• @GTonyJacobs Yep $P=\frac {N-1}{2N-1}$ Feb 19 '18 at 20:27
• You certainly don't need hypothesis testing. We're not making inferences from a sample about an otherwise unknowable population. This is just a probability question with all of the parameters known. Kind of a tricky one, maybe, but there might be a good symmetry argument for why there's no difference. Feb 19 '18 at 20:37
• @GTonyJacobs Correct. I'll see if I can edit the post. Feb 20 '18 at 21:34

It doesn't matter if the partitioning happens before or after the first draw. Suppose it happens after. Suppose also that the first sock drawn was black.

Now, we partition off $N$ from the remaining $2N-1$, to obtain our pool for the second draw. On average, the composition of this pool is $\frac{N-1}{2N-1}$ black and $\frac{N}{2N-1}$ white. Drawing from it, we have a matching pair if we draw from the portion of it that is black, i.e., $\frac{N-1}{2N-1}$.

The trick to simplifying the work is to work with expected values for the number of socks of each color in the second part of the partition, not actual values.

No, the chances don't change. If you worked out all the conditional probabilities based on how the socks split and summed appropriately you'd get the same answer: $(N-1)/(2N -1)$. The partition gives you no new information.

Here's the brute force calculation for $N=2$. There are two possible partitions, WW|BB and WB|WB. The first of these occurs with probability $1/3$. the second with probability $2/3$. In the first case you fail for sure. In the second you succeed half the time. On average you succeed with probability $$0 \times \frac{1}{3} + \frac{1}{2} \times \frac{2}{3} = \frac{1}{3} = \frac{2-1}{4-1}.$$

(There's probably a really elegant argument from symmetry that I don't see.)

Of course it shouldn't change!

Let's see if the math works out for a simple example, say $N=3$

First, the 'normal' calculation says that the chances of getting a match $M$ is:

$$P(M)= \frac{N-1}{2N-1}=\frac{2}{5}$$

Now let's see what happens when you randomly partition them.

Let's say you first pick from the left side. After randomly splitting the socks into two groups, there can be $0$, $1$, $2$, or $3$ socks there, with respective probabilities of:

$$P(0)= \frac{{3 \choose 0}\cdot{3 \choose 3}}{6 \choose 3} = \frac{1}{20}$$

$$P(1)= \frac{{3 \choose 1}\cdot{3 \choose 2}}{6 \choose 3} = \frac{9}{20}$$

$$P(2)= \frac{{3 \choose 2}\cdot{3 \choose 1}}{6 \choose 3} = \frac{9}{20}$$

$$P(3)= \frac{{3 \choose 3}\cdot{3 \choose 0}}{6 \choose 3} = \frac{1}{20}$$

Now, getting a match $M$ in the first and last situation is impossible, so $$P(M|0)=P(M|3)=0$$

When there is $1$ white sock on the left, the chances of getting a match are the chance of getting that white sock times the chances of getting one of the two socks on the right side, plus the chances of getting one of the two black ones on the left and the one black one on the right. And, with $2$ white socks on the left it's all symmetrical. So:

$$P(M|1)=P(M|2)=\frac{1}{3}\cdot \frac{2}{3} + \frac{2}{3} \cdot \frac{1}{3} = \frac{4}{9}$$

In sum:

$$P(M)=P(0)\cdot P(M|0) + P(1)\cdot P(M|1) +P(2)\cdot P(M|2) +P(3)\cdot P(M|3) =$$

$$\frac{1}{20} \cdot 0 + \frac{9}{20} \cdot \frac{4}{9} + \frac{9}{20} \cdot \frac{4}{9} + \frac{1}{20} \cdot 0 = \frac{8}{20} = \frac{2}{5}$$

OK, so yes, same chance!

Now, I'm sure you can generalize this for any $N$ ... thus evaluating the series:

$$P(M)=\sum_{i=0}^N \frac{{N \choose i} \cdot {N \choose {N-i}}}{2N \choose N} \cdot 2 \cdot \frac{i}{N} \cdot \frac{N-i}{N}$$

[... Insert some math that's over my head ....]

... and you'll see that this ends up being $$\frac{N-1}{2N-1}$$


# Proving that a number is non-negative?

The numbers $a$,$b$ and $c$ are real. Prove that at least one of the three numbers $$(a+b+c)^2 -9bc \hspace{1cm} (a+b+c)^2 -9ca \hspace{1cm} (a+b+c)^2-9ab$$ is non-negative.

Any hints would be appreciated too.

• Have you considered adding them up and seeing if they are a square ? – Belgi Aug 16 '14 at 17:42

Hint:

If all three numbers are negative, then:

$$ab > \left(\frac{a+b+c}{3}\right)^2 \hspace{1cm} ac > \left(\frac{a+b+c}{3}\right)^2 \hspace{1cm} bc > \left(\frac{a+b+c}{3}\right)^2 \hspace{1cm}$$

Therefore, if we multiply the three inequalities:

$$a^2b^2c^2 > \left(\frac{a+b+c}{3}\right)^6$$

Or equivalently:

$$\left(\sqrt[3]{abc}\right)^6 > \left(\frac{a+b+c}{3}\right)^6$$

Do you know any inequality you can use here do disprove this?

• @Sudhanshu Look for the Arithmetic-Geometric Median Inequality en.wikipedia.org/wiki/… It says that: $$\frac{a+b+c}{3} \geq \sqrt[3]{abc}$$ – Darth Geek Aug 16 '14 at 17:50
• Oh, how can I forget that...Thanks btw. – Sudhanshu Aug 16 '14 at 17:54
• But since we assume these numbers to be negative how can we apply A.M > G.M ? – Sudhanshu Aug 16 '14 at 18:04
• If we assume those three numbers are negative, then they contradict the "AM>GM" inequality wich we know to be true. Therefore our assumption was incorrect, i.e. at least one of those numbers was not negative. This sort of proof is called "proof by contradiction" or "reductio ad absurdum". You start with a hypothesis and you end up in a contradiction, wich means that the hypothesis was false. – Darth Geek Aug 16 '14 at 18:14
• But I think the A.M > G.M rule is applicable only for positive numbers – Sudhanshu Aug 16 '14 at 18:15

$$\sum [(a+b+c)^2-9bc]=3\sum[a^2+b^2+c^2-ab-bc-ca]=\frac32\sum (a-b)^2\ge0$$

If each $(a+b+c)^2-3bc<0,$ $$\sum [(a+b+c)^2-3bc]<0$$

• You can also observe that $\sum[a^2+b^2+c^2-ab-bc-ca]\ge0$ is just Cauchy -Schwarz. – N. S. Aug 16 '14 at 18:38


# interior point in metric space

FACTS A point is interior if and only if it has an open ball that is a subset of the set x 2intA , 9">0;B "(x) ˆA A point is in the closure if and only if any open ball around it intersects the set x 2A , 8">0;B "(x) \A 6= ? Metric Spaces A metric space is a set X that has a notion of the distance d(x,y) between every pair of points x,y ∈ X. Definition: We say that x is an interior point of A iff there is an such that: . Browse other questions tagged metric-spaces or ask your own question. Defn Suppose (X,d) is a metric space and A is a subset of X. True. A point x ∈ E is said to be an interior point of E if E contains an open ball centered at x. Since you can construct a ball around 3, where all the points in the ball is in the metric space. (d) Describe the possible forms that an open ball can take in X = (Q ∩ [0; 3]; dE). Proposition A set O in a metric space is open if and only if each of its points are interior points. When we encounter topological spaces, we will generalize this definition of open. $\begingroup$ As an addendum, singletons are open if and only if the metric space is induced by a discrete metric, so there's only one case in which you have a nonempty interior of singleton sets. - the exterior of . We do not develop their theory in detail, and we leave the veriﬁcations and proofs as an exercise. In most cases, the proofs Let E be a subset of a metric space X. However, this definition of open in metric spaces is the same as that as if we regard our metric space as a topological space. - the boundary of Examples. $\endgroup$ – Alan Apr 18 '15 at 8:32 METRIC SPACES 77 where 1˜2 denotes the positive square root and equality holds if and only if there is a real number r, with 0 n r n 1, such that yj rxj 1 r zj for each j, 1 n j n N. Remark 3.1.9 Again, it is useful to view the triangular inequalities on “familiar \begin{align} \quad \mathrm{int} \left ( \bigcup_{S \in \mathcal F} S\right ) \supseteq \bigcup_{S \in \mathcal F} \mathrm{int} (S) \quad \blacksquare \end{align} If is the real line with usual metric, , then A point x is called an isolated point of A if x belongs to A but is not a limit point of A. Interior Point Not Interior Points Definition: ... A set is said to be open in a metric space if it equals its interior (= ()). This intuitively means, that x is really 'inside' A - because it is contained in a ball inside A - it is not near the boundary of A. Let (X;d) be a metric space and A ˆX. Let be a metric space, Define: - the interior of . Let be a metric space. (c) The point 3 is an interior point of the subset C of X where C = {x ∈ Q | 2 < x ≤ 3}? The interior of the set E is the set of all its interior points. A point is exterior … An open ball of radius centered at is defined as Definition. Metric space: Interior Point METRIC SPACE: Interior Point: Definitions. This set is denoted by intE. 1. In these examples, all sets under consideration are subsets of the metric space R. Example 2.7. Appendix A. If has discrete metric, 2. Metric Spaces, Topological Spaces, and Compactness 253 Given Sˆ X;p2 X, we say pis an accumulation point of Sif and only if, for each ">0, there exists q2 S\ B"(p); q6= p.It follows that pis an The purpose of this chapter is to introduce metric spaces and give some deﬁnitions and examples. Proposition A set C in a metric space is closed if and only if it contains all its limit points. 3.2. Featured on Meta “Question closed” notifications experiment results and graduation


# Are there any alternatives for NIntegrate to calculate the area for which $f(x,y)<0$?

I have this two-variable function $$f(x,y)= (8 \cos (x+y)+7)\cos \left(\frac{x}{2}\right)+\cos \frac{x-2 y}{2}+2 \cos \left(\frac{3 x}{2}\right)$$ where $$0. I want to calculate numerically the area for which the function is negative $$f(x,y)<0$$. I use this code

NIntegrate[
Boole[2 Cos[(3 x)/2] + Cos[1/2 (x - 2 y)] +
Cos[x/2] (7 + 8 Cos[x + y]) < 0], {x, 0, Pi}, {y, 0, Pi}]

and it gives the answer $$3.49458$$, but Mathematica gives the following warnings. Are there any other ways to calculate this value that is more reliable and more accurate than this method?

NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.

NIntegrate::eincr: The global error of the strategy GlobalAdaptive has increased more than 2000 times. The global error is expected to decrease monotonically after a number of integrand evaluations. Suspect one of the following: the working precision is insufficient for the specified precision goal; the integrand is highly oscillatory or it is not a (piecewise) smooth function; or the true value of the integral is 0. Increasing the value of the GlobalAdaptive option MaxErrorIncreases might lead to a convergent numerical integration. NIntegrate obtained 3.494581434480605 and 0.002397336775896384 for the integral and error estimates.

• Your f[x, y] is a constant rather than a function of x and y. Jun 17, 2021 at 19:03
• @BobHanlon Thanks, it was a typo mistake.
– user80186
Jun 17, 2021 at 23:21
• There is an exact solution to your integral $-2 \text{Li}_2\left(-\frac{1}{2}\right)+\text{Li}_2\left(\frac{1}{4} \left(i \sqrt{3}+1\right)\right)+\text{Li}_2\left(\frac{1}{4} \left(1-i \sqrt{3}\right)\right)+\frac{2 \pi ^2}{9}$ Jun 18, 2021 at 13:12
• @yarchik I think you should add that and its derivation as an answer.
– Kiro
Jun 18, 2021 at 14:03
• @SaraChem @Kiro I was simply a bit more patient than @eyorble. I used u = Integrate[upperCurve, {x, 0, Pi}] and v = Integrate[lowerCurve, {x, 0, 2 Pi/3}], followed by u-v. The lowerCurve and the upperCurve are defined in eyorble's post. Jun 18, 2021 at 19:46

Let us name the function of interest f[x,y]:

f[x_, y_] := (8 Cos[x + y] + 7) Cos[x/2] + Cos[(x - 2 y)/2] + 2 Cos[3 x/2]

Attempt to ContourPlot to find the zero lines:

ContourPlot[f[x, y] == 0, {x, 0, Pi}, {y, 0, Pi}]

Simple numerical evaluation determines that the negative region is the inside of these two curves. Notice that the ContourPlot is quite rapid and has very clean lines. Interesting coincidence. Perhaps there exists an analytical solution to these curve lines?

sol = Solve[{f[x, y] == 0}]

This returns a list of 4 possible curves, while also stating that some solutions may be missing. By manual inspection (such as by using Plot), we can find that the 2nd and 4th solutions are of interest to us, so we shall label them:

upperCurve = y /. sol[[2]];
lowerCurve = y /. sol[[4]];
Plot[{upperCurve, lowerCurve}, {x, 0, Pi}, PlotRange -> {0, Pi}]

Checking the curves manually by plotting them against the original ContourPlot, we see that upperCurve matches the upper line for the whole domain, and that lowerCurve matches the lower line up until it reaches its minimum.

Find the minimum of the lowerCurve:

FindMinimum[{lowerCurve, 0 < x < Pi}, x, WorkingPrecision -> 25]

{1.872299341324760554288429*10^-8, {x -> 2.094395111754692173633430}}

The warning about a small imaginary part is of little concern here, but you can increase the WorkingPrecision and PrecisionGoal if you would like more digits.

Michael Seifert also pointed out that an exact form can be found for this solution by applying TrigFactor to f[x,y]:

TrigFactor[f[x,y]]

2 (Cos[x/2 - y/2] + 2 Cos[x/2 + y/2]) (2 Cos[x + y/2] + Cos[y/2]) == 0

The lower line happens to correspond to the second variable factor in this expression, and its minimum is found when y is set to 0 and solved.

Solve[{(2 Cos[x + y/2] + Cos[y/2]) == 0 /. y -> 0, 0 < x < Pi}, x]

{{ x -> 2 Pi/ 3 }}

Integrate the area below the 2nd curve over the whole domain minus the area under the 4th curve for 0 through 2.094...

NIntegrate[upperCurve, {x, 0, Pi}, WorkingPrecision -> 25] -
NIntegrate[lowerCurve, {x, 0, 2.0943951117546921736334297747816890478125.},
WorkingPrecision -> 25]

3.49805583366099845069196

Or with the exact form, we can see a slightly different answer:

NIntegrate[upperCurve, {x, 0, Pi}, WorkingPrecision -> 25] -
NIntegrate[lowerCurve, {x, 0, 2 Pi/3}, WorkingPrecision -> 25]

3.49805583366099836305434

While this method is not universally applicable, it does work for this function and is much faster than Area or direct application of NIntegrate and Boole for high precisions. As yarchik notes, you can swap NIntegrate for Integrate here to acquire an exact solution, though it takes a bit longer to evaluate.

• Using TrigFactor on f[x,y] shows that the two curves are $\cos((x-y)/2) + 2 \cos((x+y)/2) = 0$ (upper) and $2 \cos (x+y/2)+ \cos(y/2) = 0$ (lower). I don't know if that really helps, though. Jun 17, 2021 at 20:10
• If nothing else, it shows that the intersection of the lower curve with the $x$-axis is when $2 \cos x + 1 = 0$, or $x = 2 \pi/3$. Jun 17, 2021 at 20:12
• There are a lot of inconsistencies in your answer. What is y that you are integrating? Jun 18, 2021 at 11:51
• @yarchik The y in the integration should be read as y /. sol[[2]] (which is the upper curve from the contour plot) or y /. sol[[4]] (which is the lower curve from the contour plot). These are just explicit forms (in x) of the curves where f[x,y]==0, selected to match the curves we are interested in. Jun 18, 2021 at 12:02
• @yarchik I have modified the answer to hopefully clarify what's being integrated here. Jun 18, 2021 at 12:11
Clear["Global*"]

RegionPlot[
2 Cos[(3 x)/2] + Cos[1/2 (x - 2 y)] + Cos[x/2] (7 + 8 Cos[x + y]) < 0,
{x, 0, Pi}, {y, 0, Pi},
Frame -> True]

rgn = ImplicitRegion[{2 Cos[(3 x)/2] + Cos[1/2 (x - 2 y)] +
Cos[x/2] (7 + 8 Cos[x + y]) < 0 && 0 < x < Pi &&
0 < y < Pi}, {x, y}];

Area[rgn, WorkingPrecision -> MachinePrecision]

(* 3.49805 *)

Area[rgn, WorkingPrecision -> 15]

(* 3.49805 *)

A similar way is

reg=ImplicitRegion[
2 Cos[(3 x)/2] + Cos[1/2 (x - 2 y)] + Cos[x/2] (7 + 8 Cos[x + y]) <
0, {{x, 0, Pi}, {y, 0, Pi}}];
NIntegrate[1, {x, y} ∈ reg]

3.49485

• Thanks. Does WorkingPrecission matter in this method? I see a small difference in the different answers here obtained by different methods others suggested; if I need the most accurate one, which one is more reliable?
– user80186
Jun 18, 2021 at 12:54

Method ->"LocalAdaptive"  evaluates without errormessage

NIntegrate[Boole[2 Cos[(3 x)/2] + Cos[1/2 (x - 2 y)] +Cos[x/2] (7 + 8 Cos[x + y]) < 0], {x, 0, Pi}, {y,0, Pi}, Method -> "LocalAdaptive"]
(*3.49818*)

• Thanks. Does WorkingPrecission matter in this method? I see a small difference in the different answers here obtained by different methods others suggested; if I need the most accurate one, which one is more reliable?
– user80186
Jun 18, 2021 at 12:55
• @SaraChem Sorry, I was offline some days. If you add the option , IntegrationMonitor :> ((errors = Through[#1@"Error"]) &) inside NIntegrate , it's possible to evaluate the integrationerror Total@errors afterwards. Might be helpful. Jun 20, 2021 at 14:27


A few words about PWW #33: subset permutations

My previous post showed four rows of diagrams, where the $n$th row (counting from zero) has diagrams with $n+2$ dots. The diagrams in the $n$th row depict all possible paths that

1. start at the top left dot,
2. end at the top right dot, and
3. never visit any dot more than once.

For a given diagram, we can choose which dots to visit (representing a subset of the dots), and we can visit the chosen dots in any order (a permutation). I will call the resulting things “subset permutations”, although I don’t know if there is some other more accepted term for them.

It’s not necessary to draw subset permutations as paths; it’s just one nice visual representation. If we number the dots from $1 \dots n$ (excluding the top two, which are uninteresting), each path corresponds precisely to a permutation of some subset of $\{1 \dots n\}$. Like this:

I thought of this idea the other day—of counting the number of “subset permutations”—and wondered how many there are of each size. I half expected it to turn out to be a sequence of numbers that I already knew well, like the Catalan numbers or certain binomial coefficients or something like that. So I was surprised when it turned out to be a sequence of numbers I don’t think I have ever encountered before (although it has certainly been studied by others).

So, how many subset permutations are there of size $n$? Let’s call this number $\mathit{SP}_n$. From my previous post we can see that starting with $\mathit{SP}_0 = 1$, the first few values are $1, 2, 5, 16$. (When I saw 1, 2, 5, I thought sure it was going to be the Catalan numbers—but then the next number was 16 instead of 14…) Can we compute these more generally without just listing them all and counting?

Well, to choose a particular subset permutation of size $n$, we can first choose how big we want the subset to be, i.e. how many dots to visit, which could be zero, or $n$, or anything in between. Once we choose to visit $k$ out of $n$ dots, then we have $n$ choices for which dot to visit first, then $(n-1)$ choices for which dot to visit second, all the way down to $(n-k+1)$ choices for the last dot (you should convince yourself that $(n-k+1)$, not $(n-k)$, is correct!). This is often notated

$\displaystyle {}_n P_k = n (n-1) (n-2) \dots (n-k+1) = \frac{n!}{(n-k)!}.$

So, in total then, $\mathit{SP}_n$ is the sum of ${}_n P_k$ over all possible $k$, that is,

$\displaystyle \mathit{SP}_n = \sum_{0 \leq k \leq n} \frac{n!}{(n-k)!}.$

This is already better than just listing all the subset permutations and counting. For example, we can compute that

$\mathit{SP}_4 = 4!/4! + 4!/3! + 4!/2! + 4!/1! + 4!/0! = 1 + 4 + 12 + 24 + 24 = 65.$

And sure enough, if we list them all, we get 65 (you’ll just have to take my word that this is all of them, I suppose!):

However, with a little algebra, we can do even better! First, let’s write out the sum for $\mathit{SP}_n$ explicitly:

$\mathit{SP}_n = 1 + n + n(n-1) + n(n-1)(n-2) + \dots + n!$

If we factor $n$ out of all the terms after the initial $1$, we get

$\mathit{SP}_n = 1 + n[1 + (n-1) + (n-1)(n-2) + \dots + (n-1)!] = 1 + n \mathit{SP}_{n-1}$

so the subset permutation numbers actually follow a very simple recurrence! To get the $n$th subset permutation number, we just multiply the previous one by $n$ and add one.

$\begin{array}{rcl} \mathit{SP}_0 &=& 1 \\ \mathit{SP}_1 &=& 1 \cdot 1 + 1 = 2 \\ \mathit{SP}_2 &=& 2 \cdot 2 + 1 = 5 \\ \mathit{SP}_3 &=& 3 \cdot 5 + 1 = 16 \end{array}$

and sure enough, $\mathit{SP}_4 = 4 \cdot 16 + 1 = 65$. We can now easily calculate the next few subset permutation numbers:

$1,2,5,16,65,326,1957,13700,109601,986410, \dots$

A commenter also wondered about the particular order in which I listed subset permutations in my previous post. The short, somewhat disappointing answer is “whatever order came out of the standard library functions I used”. However, there are definitely more interesting things to say about the ordering, and I think I’ll probably write about that in another post.

Posted in combinatorics, posts without words | Tagged , , , | 6 Comments

Post without words #33

Posted in combinatorics, posts without words | Tagged , , | 4 Comments

Happy tau day!

Happy Tau Day! The Tau Manifesto by Michael Hartl is now available in print, if you’re in the market for a particularly nerdy coffee table book and conversation starter:

I also wrote about Tau Day ten years ago; see that post for more links! Using $\tau$ we can make the most beautiful equation in the world even more beautiful:

$e^{i \tau} = 1 + 0i$

Please enjoy eating two pi(e)s today. I’ll be back soon with some solutions to the parallelogram area challenge!

Posted in famous numbers, links | Tagged , , | 1 Comment

Challenge: area of a parallelogram

And now for something completely different!1

Suppose we have a parallelogram with one corner at the origin, and two adjacent corners at coordinates $(a,b)$ and $(c,d)$. What is the area of the parallelogram?

1. …or is it?

Posted in challenges, geometry | Tagged , | 18 Comments

Post without words #32

Posted in posts without words | Tagged , , , | 8 Comments

The Natural Number Game

Hello everyone! It has been quite a while since I have written anything here—my last post was in March 2020, and since then I have been overwhelmed dealing with online and hybrid teaching, plus a newborn (who is now almost 5 months old and very cute):

But the spring semester is finally over, and I have a sabbatical in the fall, so I plan to do a bunch more writing! I have several ideas of things to come (feel free to send me suggestions as well), but to start things out for today I just have a fun link:

The idea is to use a computer proof assistant to formally prove a lot of basic facts about arithmetic. That is, you get to build proofs using a special precise notation, and the computer will automatically check whether your proof is correct. But the whole thing is organized like a game, with a tutorial, levels that build on each other and introduce new ideas and techniques just before you need them, etc. It’s a lot of fun and honestly kind of addicting.

There is very little background needed other than some capability for abstract thinking. Things start out quite easy and progress slowly, though things become quite challenging by the time you make it all the way to the end.

Posted in challenges, computation, proof | Tagged , , , , , | 6 Comments

An exploration of forward differences for bored elementary school students

Last week I made a mathematics worksheet for my 8-year-old son, whose school is closed due to the coronavirus pandemic. I’m republishing it here so others can use it for similar purposes.

Figurate numbers and forward differences

There are lots of further directions this could be taken but I’ll leave that to you and your kids. I tried to create something that was conducive to open-ended exploration rather than something that had a single particular goal in mind.

• For the curious: Babbage Difference Engine
• For the intrepid: Concrete Mathematics by Graham, Knuth, and Patashnik, section 2.6 (“Finite and Infinite Calculus”)

Seeing as how we’ve got at least four more weeks of (effectively) homeschooling ahead of us, and probably more than that, in all likelihood I will be making more of these, and I will certainly continue to share them here! If you use any of these with your kids I’d love to hear about your experiences.

Posted in arithmetic, teaching | | 1 Comment

Ways to prove a bijection

You have a function $f : A \to B$ and want to prove it is a bijection. What can you do?

By the book

A bijection is defined as a function which is both one-to-one and onto. So prove that $f$ is one-to-one, and prove that it is onto.

This is straightforward, and it’s what I would expect the students in my Discrete Math class to do, but in my experience it’s actually not used all that much. One of the following methods usually ends up being easier in practice.

By size

If $A$ and $B$ are finite and have the same size, it’s enough to prove either that $f$ is one-to-one, or that $f$ is onto. A one-to-one function between two finite sets of the same size must also be onto, and vice versa. (Of course, if $A$ and $B$ don’t have the same size, then there can’t possibly be a bijection between them in the first place.)

Intuitively, this makes sense: on the one hand, in order for $f$ to be onto, it “can’t afford” to send multiple elements of $A$ to the same element of $B$, because then it won’t have enough to cover every element of $B$. So it must be one-to-one. Likewise, in order to be one-to-one, it can’t afford to miss any elements of $B$, because then the elements of $A$ have to “squeeze” into fewer elements of $B$, and some of them are bound to end up mapping to the same element of $B$. So it must be onto.

However, this is actually kind of tricky to formally prove! Note that the definition of “$A$ and $B$ have the same size” is that there exists some bijection $g : A \to B$. A proof has to start with a one-to-one (or onto) function $f$, and some completely unrelated bijection $g$, and somehow prove that $f$ is onto (or one-to-one). Also, a valid proof must somehow account for the fact that this becomes false when $A$ and $B$ are infinite: a one-to-one function between two infinite sets of the same size need not be onto, or vice versa; we saw several examples in my previous post, such as $f : \mathbb{N} \to \mathbb{N}$ defined by $f(n) = 2n$. Although tricky to come up with, the proof is cute and not too hard to understand once you see it; I think I may write about it in another post!

Note that we can even relax the condition on sizes a bit further: for example, it’s enough to prove that $f$ is one-to-one, and the finite size of $A$ is greater than or equal to the finite size of $B$. The point is that $f$ being a one-to-one function implies that the size of $A$ is less than or equal to the size of $B$, so in fact they have equal sizes.

By inverse

One can also prove that $f : A \to B$ is a bijection by showing that it has an inverse: a function $g : B \to A$ such that $g(f(a)) = a$ and $f(g(b)) = b$ for all $a \in A$ and $b \in B$. As we saw in my last post, these facts imply that $f$ is one-to-one and onto, and hence a bijection. And it really is necessary to prove both $g(f(a)) = a$ and $f(g(b)) = b$: if only one of these hold then $g$ is called a left or right inverse, respectively (more generally, a one-sided inverse), but $f$ needs to have a full-fledged two-sided inverse in order to be a bijection.

…unless $A$ and $B$ are of the same finite size! In that case, it’s enough to show the existence of a one-sided inverse—say, a function $g$ such that $g(f(a)) = a$. Then $f$ is (say) a one-to-one function between finite equal-sized sets, hence it is also onto (and hence $g$ is actually a two-sided inverse).

We must be careful, however: sometimes the reason for constructing a bijection in the first place is in order to show that $A$ and $B$ have the same size! This kind of thing is common in combinatorics. In that case one really must show a two-sided inverse, even when $A$ and $B$ are finite; otherwise you end up assuming what you are trying to prove.

By mutual injection?

I’ll leave you with one more to ponder. Suppose $f : A \to B$ is one-to-one, and there is another function $g : B \to A$ which is also one-to-one. We don’t assume anything in particular about the relationship between $f$ and $g$. Are $f$ and $g$ necessarily bijections?

Posted in logic, proof | | 7 Comments

One-sided inverses, surjections, and injections

Several commenters correctly answered the question from my previous post: if we have a function $f : A \to B$ and $g : B \to A$ such that $g(f(a)) = a$ for every $a \in A$, then $f$ is not necessarily invertible. Here are a few counterexamples:

• Commenter Buddha Buck came up with probably the simplest counterexample: let $A$ be a set with a single element, and $B$ a set with two elements. It does not even matter what the elements are! There’s only one possible function $g : B \to A$, which sends both elements of $B$ to the single element of $A$. No matter what $f$ does on that single element $a \in A$ (there are two choices, of course), $g(f(a)) = a$. But clearly $f$ is not a bijection.

• Another counterexample is from commenter designerspaces: let $f : \mathbb{N} \to \mathbb{Z}$ be the function that includes the natural numbers in the integers—that is, it acts as the identity on all the natural numbers (i.e. nonnegative integers) and is undefined on negative integers. $g : \mathbb{Z} \to \mathbb{N}$ can be the absolute value function. Then $g(f(n)) = |n| = n$ whenever $n$ is a natural number, but $f$ is not a bijection, since it doesn’t match up the negative integers with anything.

Unlike the previous example, in this case it is actually possible to make a bijection between $\mathbb{N}$ and $\mathbb{Z}$, for example, the function that sends even $n$ to $n/2$ and odd $n$ to $-(n+1)/2$.

• Another simple example would be the function $f : \mathbb{N} \to \mathbb{N}$ defined by $f(n) = 2n$. Then the function $g(n) = \lfloor n/2 \rfloor$ satisfies the condition, but $f$ is not a bijection, again, because it leaves out a bunch of elements.

• Can you come up with an example $f : \mathbb{R} \to \mathbb{R}$ defined on the real numbers $\mathbb{R}$ (along with a corresponding $g$)? Bonus points if your example function is continuous.

All these examples have something in common, namely, one or more elements of the codomain that are not “hit” by $f$. Michael Paul Goldenberg noted this phenomenon in general. And in fact we can make this intuition precise.

Theorem. If $f : A \to B$ and $g : B \to A$ such that $g(f(a)) = a$ for all $a \in A$, then $f$ is injective (one-to-one).

Proof. Suppose for some $a_1, a_2 \in A$ we have $f(a_1) = f(a_2)$. Then applying $g$ to both sides of this equation yields $g(f(a_1)) = g(f(a_2))$, but because $g(f(a)) = a$ for all $a \in A$, this in turn means that $a_1 = a_2$. Hence $f$ is injective.

Corollary. since bijections are exactly those functions which are both injective (one-to-one) and surjective (onto), any such function $f : A \to B$ which is not a bijection must not be surjective.

And what about the opposite case, when there are functions $f : A \to B$ and $g : B \to A$ such that $f(g(b)) = b$ for all $b \in B$? As you might guess, such functions are guaranteed to be surjective—can you see why?

Posted in logic | | 1 Comment

Suppose we have sets $A$ and $B$ and a function $f : A \to B$ (that is, $f$’s domain is $A$ and its codomain is $B$). Suppose there is another function $g : B \to A$ such that $g(f(a)) = a$ for every $a \in A$. Is $f$ necessarily a bijection? That is, does $f$ necessarily match up each element of $A$ with a unique element of $B$ and vice versa? Or put yet another way, is $f$ necessarily invertible?