# Integral of periodic function over the length of the period is the same everywhere

I am stuck on a question that involves the intergral of a periodic function. The question is phrased as follows:

Definition. A function is periodic with period $a$ if $f(x)=f(x+a)$ for all $x$.

Question. If $f$ is continuous and periodic with period $a$, then show that $$\int_{0}^{a}f(t)dt=\int_{b}^{b+a}f(t)dt$$ for all $b\in \mathbb{R}$.

I understand the equality, but I am having trouble showing that it is true for all $b$. I've tried writing it in different forms such as $F(a)=F(b+a)-F(b)$. This led me to the following, though I am not sure how this shows the equality is true for all $b$,

$$\int_{0}^{a}f(t)dt-\int_{b}^{b+a}f(t)dt=0$$ $$=F(a)-F(0)-F(b+a)-F(b)$$ $$=(F(b+a)-F(a))-F(b)$$ $$=\int_{a}^{b+a}f(t)dt-\int_{0}^{b+a}f(t)dt=0$$

So, this leaves me with

$$\int_{a}^{b+a}f(t)dt-\int_{0}^{b+a}f(t)dt=\int_{0}^{a}f(t)dt-\int_{b}^{b+a}f(t)dt$$

I feel I am close, and I've made myself a diagram of a sine function to visualize what each of the above integrals might describe, but the power to explain the above equality evades me.

• See here for some proofs. – t.b. Jan 12 '12 at 8:09
• (Voted to close as duplicate) Even though this says continuous and the other says integrable, the proofs are the same, i.e. every proof here would apply over there. – 6005 Jul 17 '16 at 16:25

Let $H(x)=\int_x^{x+a}f(t)\,dt$. Then $$\frac{dH}{dx}=f(x+a)-f(x)=0.$$ It follows that $H(x)$ is constant. In particular, $H(b)=H(0)$.

We have $$\int_{0}^{a}f(t)\ dt+\int_{a}^{a+b}f(x)\ dx=\int_{0}^{b}f(y)\ dy+\int_{b}^{a+b}f(t)\ dt,$$ and setting $x=y-a$ turns the second integral into the third one.

No differentiation is needed:

Pick the unique integer $n$ such that $b\leqslant na\lt b+a$, decompose the integral of $f(t)$ over $t$ from $b$ to $b+a$ into the sum of the integrals from $b$ to $na$ and from $na$ to $b+a$, apply the changes of variable $t=x+(n-1)a$ in the former and $t=x+na$ in the latter, then the periodicity of $f$ implies that $f(x)=f(t)$, hence the result is the sum of the integrals of $f(x)$ over $x$ from $b-(n-1)a$ to $a$ and from $0$ to $b-(n-1)a$...

...Et voilà !

You have made various false steps in your four line block and should have ended up with $$\int_{a}^{b+a}f(t)dt-\int_{0}^{b}f(t)dt=0$$ but this does not take you much further forward.

Instead note that somewhere in the interval $[b, b+a]$ is an integer multiple of $a$, say $na$. Then using $f(t)=f(t+a)=f(t+na)$: $$\int_{b}^{b+a}f(t)dt = \int_{b}^{na}f(t)dt+\int_{na}^{b+a}f(t)dt = \int_{b+a}^{(n+1)a}f(t)dt+\int_{an}^{b+a}f(t)dt = \int_{na}^{(n+1)a}f(t)dt = \int_{0}^{a}f(t)dt.$$

\begin{align} \int_{b}^{a+b}f(x)\ dx&= \int_{a}^{a+b}f(x)\ dx +\int_{b}^{a}f(x)\ dx\\&\overset{y=x-a}{=} \color{red}{\int_{0}^{a}f(y+a)\ dx} +\int_{b}^{a}f(x)\ dx\\&\overset{periodic}{=} \color{red}{\int_{0}^{b}f(y)\ dx} +\int_{b}^{a}f(x)\ dx\\&=\int_0^af(x)\ dx. \end{align}

• why a down vote here – Guy Fsone Jan 18 '18 at 8:15
• The integral is obtained in the second line itself. You have done a calculation mistake. – Robin Feb 17 '18 at 8:56
• Furthermore, this plagiarizes simultaneously three other answers, posted six years before. – Did Feb 18 '18 at 15:23


### Home > CCG > Chapter 9 > Lesson 9.1.3 > Problem9-35

9-35.

Are $ΔEHF$ and $ΔFGE$ congruent? If so, explain how you know. If not, explain why not.

What do the markings on the figures mean?
What other parts do these triangles have in common?

Yes, they are congruent. What is the reason?


# Create a particular {x,y} list [duplicate]

How is it possible to create a list of {x,y} points as the following one:

list={{1,1},{1,2},...,{1,100},{2,1},{2,2},...,{2,100},...,{100,1},{100,2},...,{100,100}}

Thanks

• Table[{i,j}, {i, 100}, {j, 100}]? What have you tried? Feb 27 '17 at 16:23
• Hi, I was using Range, but it doesn't work for 2D lists. However, you answer gives my some additional brackets that are unwanted, like this: {{{1,1},{1,2},...,{1,100},{2,1},{2,2},...,{2,100},...,{100,1},{100,2},...,{100,100}}}. I've found the way with Flatten[]. Thanks for your help! Feb 27 '17 at 16:45
• Not an exact duplicate but a more general topic. Let me know if you disagree with closing.
– Kuba
Feb 27 '17 at 16:46
• @Michele You need to Flatten the result; consider Flatten[Table[{i, j}, {i, 1, 100}, {j, 100}], 1]. More in general, also take a look at the proposed duplicate. Feb 27 '17 at 16:49
• Join @@ Array[List , {100, 100} ] Feb 27 '17 at 20:24

Tuples[Range[100], 2]

or using Table as mentioned in the comment
It is worth noting that the method relying on Tuples is 10-12 times faster than Table


# Notes on Dijkstra's Algorithm

## Setup

We are given a directed graph $G=(V,E)$ with a designated start node $s$. Each edge $(u, v) \in E$ has a weight $w(u,v) \geq 0$ indicating its cost. For each vertex $v \in V$, it has a predecessor $v.\pi$ that is another vertex or NIL.

## Goal

Find the shortest path from $s$ to every other vertex in the graph.

## Pseudocode

$Q$ is a min-priority queue of vertices, keyed by their $d$ values.

#### 1.DIJKSTRA$(G, s)$

$S = \varnothing$
$Q = G.V$
while $Q \neq \varnothing$
$u =$ EXTRACT-MIN(Q)
$S = S \cup \{u\}$
for each vertex $v \in G.Adj[u]$
RELAX(u,v,w)

#### 2.INITIALIZE-SINGLE-SOURCE$(G,s)$

for each vertex $v \in V[G]$
$v.d = \infty$
$v.\pi$ = NIL
$d[s] = 0$

#### 3. RELAX$(u,v,w)$

if $v.d > u.d + w(u,v)$
$v.d = u.d + w(u,v)$
$v.\pi = u$

## Proof of correctness

We want to show that the algorithm terminates with $u.d$ = $\delta(s,u)$ for all $u \in V$, where $\delta(s,u)$ is the shortest path weight from $s$ to $u$, and is defined as
$\delta(s, u) = \begin{cases} min\{w(p):s\xrightarrow{\text{p}}u\} , & \quad \text{if there is a path from s to u}\\ \infty , & \quad \text{otherwise} \end{cases}$

$w(p)$ is the sum of weights of the path $p$

## We first show

At the start of each iteration of the while loop in Dijkstra’s algorithm, $v.d = \delta(s, v)$ for each vertex $v \in S$ (*)

1) Base Case:
|S| = 0, i.e when $S = \varnothing$, the statement is vacuously true.

2) Inductive Step:
Suppose the claim holds when $|S| = k$ for some $k \geq 1$. Now, let $S$’s size grow to $k+1$ by adding vertex $v$. We want to show $v.d = \delta(s,v)$.

If $v=s$ then $s.d = \delta(s,s) =0$. If $v \neq s$, it must be $S \neq \varnothing$. If there’s no path form $s$ to $v$, $v.d = \delta(s,v)= \infty$. If there are some path from $s$ to $v$, there sholud be one shortest path $p$ from $s$ to $v$.

Let us consider the first vertex $y$ on $p$ that is not in $S$, and let $x$ on $p$ be $y’s$ predecessor. By induction hypothesis, $x.d = \delta(s,x)$. Because edge $(x, y)$ is relaxed in the previous iteration, by convergence property (if $s\rightarrow u\rightarrow v$ is a shortest path in G for some $u, v \in V$, and if $u.d = \delta(s,u)$ at any time prior to relaxing edge $(u,v)$, then $v.d = \delta(s,v)$ at all times afterwards), we have $y.d = \delta(s,y)$. Since $y$ is before $v$ on $p$ and all edge weights are nonnegative, we have $\delta(s,y) \leq \delta(s,v)$, and thus $y.d = \delta(s,y) \leq \delta(s,v)\leq v.d$
Because both vertices $v$ and $y$ are in $V-S$ when $v$ is selected by the algorithm, $v.d \leq y.d$. Thus, $y.d = \delta(s,y) = \delta(s,v) = v.d$, and so $v.d = \delta(s,v)$, and so complete the proof of (*).

## Now

When the algorithm terminates, it means $Q = \varnothing$. Since the algorithm maintains the invariant that $Q = V - S$ (when initialization, $S = \varnothing$ and $Q$ contains all vertices of graph; for every time through while loop, a vertex is extracted from $Q$ and added to $S$, so the invariant is maintained), it means $S = V$, so $u.d = \delta(s,u)$ for all vertices $u \in V$

## Time Complexity

Using priority queue implemented in min heap, the time to initialize the queue with setting all vertices’ distances to $\infty$ is $O(V)$. Inside the while loop, we will do $V$ times EXTRACT_MIN operation, each of them will take $O(logV)$. Besides, we will do at most $E$ times of updating associated distance key for vertices in the queue, which will cost $O(ElogV)$. In total, the time will be $O((E+V)logV)$

## Java implementation

In the code below, vertices is the hashmap containing the mapping between GeographicPoint and MapNode. MapNode is made up of GeographicPoint and list of MapEdge. MapNodes in vertices are converted to DiNode in hashmap diPoints by using the method convertMap to facilitate implementation of the algorithm. The constructPath method will return the path found by the algorithm from start to goal.

See the full framework of this project here (incomplete). Note that the code may be ugly as I mainly pay attention to the algorithm itself.

public List<GeographicPoint> dijkstra(GeographicPoint start,
GeographicPoint goal, Consumer<GeographicPoint> nodeSearched){

if(!vertices.containsKey(start) || !vertices.containsKey(goal)){
System.out.println("input location does not exist in graph");
}

HashMap<GeographicPoint, DiNode> diPoints = convertMap(vertices);
HashMap<GeographicPoint, GeographicPoint> parentMap = new HashMap<>();
Set<GeographicPoint> visitSet = new HashSet<>();
PriorityQueue<DiNode> queue = new PriorityQueue<DiNode>();
DiNode cur = diPoints.get(start);
cur.sumDist = 0.0;
queue.offer(cur);

while(!queue.isEmpty()){
cur = queue.poll();
nodeSearched.accept(cur.mapNode.location);
if(!visitSet.contains(cur.mapNode.location)){
}

if(cur.mapNode.location.equals(goal)) {
return constructPath(start, goal, parentMap);
}

for (MapEdge e : cur.mapNode.edges) {
if(!visitSet.contains(e.end)){
double nbSumDist = diPoints.get(e.end).sumDist;
if(cur.sumDist + e.distance < nbSumDist){
// update cur as neightbor's parent in parent map
parentMap.put(e.end, cur.mapNode.location);
DiNode next = diPoints.get(e.end);
// update next neighbor's sum of distance
next.sumDist = cur.sumDist + e.distance;
// put neighbor with updated distance into priority queue
queue.offer(new DiNode(next.mapNode, next.sumDist));
}
}
}

}

System.out.println("There is no such path");
}

Above is one part of the back-end code of a project in UCSD’s Advanced Data Structure course. It utilizes the Google Map’s API, and can demonstrate route planning in a real world’s map as shown below. Note that the algorithm is a bit different from the one described above (instead of initializing the priority queue with inserting all vertices and later updating their sum of weighted distance, it enqueues the vertex after its distance is updated), but the general idea is the same.

## References

[1] T. Cormen, C. Stein, R. Rivest, and C. Leiserson. Introduction to Algorithms (3rd ed.). MIT press,2009.
[2] J. Kleinberg and E. Tardos. Algorithm Design. Addison-Wesley, 2005


# Which is the “fastest” way to compute $\sum \limits_{i=1}^{10} \frac{10i-5}{2^{i+2}}$?

I am looking for the "fastest" paper-pencil approach to compute $$\sum \limits_{i=1}^{10} \frac{10i-5}{2^{i+2}}$$

This is a quantitative aptitude problem and the correct/required answer is $3.75$

In addition, I am also interested to know how to derive a closed form for an arbitrary $n$ using mathematica I got $$\sum \limits_{i=1}^{n} \frac{10i-5}{2^{i+2}} = \frac{5 \times \left(3 \times 2^n-2 n-3\right)}{2^{n+2}}$$

Thanks,

-
Does someone feel like writing an "abstract duplicate" for this kind of question? I think I've seen several of them, but I don't know whether we have one that deals with this more generally and would serve as a good duplicate for all of them. –  joriki Nov 12 '11 at 15:55
The actual correct answer to this question is $\approx 3.7219$. I do not know what "quantitative aptitude test" means, but would not 3.7 be a better answer than 3.75? –  Aleksey Pichugin Nov 12 '11 at 16:36

We'll split the sum you're looking for up into

$$10 \sum_{i=1}^{10} {i \over 2^{i+2}} - 5 \sum_{i=1}^{10} {1 \over 2^{i+2}}.$$

Call this $10S_1 - 5S_2$.

We can write $$S_1 = \sum_{i=1}^{10} {i \over 2^{i+2}} = {1 \over 4} \sum_{i=1}^{10} {i \over 2^i}$$ and the result $\sum_{i=1}^\infty i/2^i = 2$ is well-known; thus $S_1 \approx 1/2$.

Similarly, $S_2 \approx \sum_{i=1}^\infty 1/2^{i+2} = 1/4$ by the usual sum of a geometric series.

So your sum is approximately $15/4$. In fact the infinite sum

$$\sum_{i=1}^\infty {10i-5 \over 2^{i+2}}$$

is exactly 15/4. We've left off some small positive terms so your sum is a bit less than $15/4$.

An exact form for the sum

As for getting an exact form for the sum: call it $f(n)$. Then we have

$$f(n) = {15 \over 4} - \left( 10 \sum_{i=n+1}^\infty {i \over 2^{i+2}} - 5 \sum_{i=n+1}^\infty {1 \over 2^{i+2}} \right).$$

Write this as $f(n) = 15/4 - g(n) + h(n)$.

$h(n)$ is easy -- it's the sum of a geometric series with its first term $5/2^{n+3}$ and ratio $1/2$, so $h(n) = 5/2^{n+2}$.

$g(n)$ is a bit harder. So that we don't have so many constants floating around, consider

$$G(n) = \sum_{i={n+1}}^\infty {i \over 2^i}$$

and you can see $g(n) = (5/2) G(n)$. Now you can write

$$G(n) = {(n+1) \over 2^{n+1}} + {{n+2} \over 2^{n+2}} + {{n+3} \over 2^{n+3}} + \cdots$$

and this is just

$$G(n) = \left( {n \over 2^{n+1}} + {n \over 2^{n+2}} + {n \over 2^{n+3}} + \cdots \right) + {1 \over 2^n} \left( {1 \over 2^1} + {2 \over 2^2} + {3 \over 2^3} + \cdots \right).$$

The first sum is a geometric series, summing to $n/2^n$; the second sum is $2$. Thus $G(n) = (n+1)/2^n$. Therefore you get

$$f(n) = {15 \over 4} - {5 \over 2} {(n+2) \over 2^n} + {5 \over 2^{n+2}}.$$

A sum that everybody should know, but lots of people don't

Finally, I used the result $\sum_{i=1}^\infty i/2^i$ twice here, both in getting the approximation and in getting the exact form. How can we prove that? One way is to write $${1 \over 2} + {2 \over 4} + {3 \over 8} + {4 \over 16} + \cdots$$ as a sum of one $1/2$, two $1/4$s, three $1/8$s, and so on; then regroup those terms as $$\left( {1 \over 2} + {1 \over 4} + {1 \over 8} + \cdots \right) + \left( {1 \over 4} + {1 \over 8} + {1 \over 16} + \cdots \right) + \left( {1 \over 8} + {1 \over 16} + {1 \over 32} + \cdots \right) + \cdots$$ Each pair of parentheses contains a geometric series; summing those gives $1 + 1/2 + 1/4 + 1/8 + \cdots$, another geometric series, which has sum $2$.

Alternatively, note that $${1 \over 1-z} = 1 + z + z^2 + z^3 + \cdots$$ and differentiating both sides gives $${1 \over (1-z)^2} = 1 + 2z + 3z^2 + \cdots$$. Multiply both sides by $z$ to get $${z \over (1-z)^2} = z + 2z^2 + 3z^3 + \cdots$$ and plug in $z = 1/2$ to get $${1/2 \over (1-1/2)^2} = {1 \over 2} + {2 \over 2^2} + {3 \over 2^3} + \cdots.$$

-

I would do it like this. Using $x \frac{\mathrm{d}}{\mathrm{d} x}\left( x^k \right) = k x^k$, and $\sum_{k=1}^n x^k = x \frac{x^n-1}{x-1}$. Then $$\begin{eqnarray} \sum_{k=1}^n \left( a k +b\right) x^k &=& \left( a x \frac{\mathrm{d}}{\mathrm{d} x} + b\right) \circ \sum_{k=1}^n x^k = \left( a x \frac{\mathrm{d}}{\mathrm{d} x} + b\right) \circ \left( x \frac{x^n-1}{x-1} \right) \\ &=& x \left( a x \frac{\mathrm{d}}{\mathrm{d} x} + a + b\right) \circ \left(\frac{x^n-1}{x-1} \right) \\ &=& x \left( (a+b) \frac{x^n-1}{x-1} + a x \frac{ n x^{n-1}(x-1) - (x^n-1) }{(x-1)^2} \right) \\ &=& x \left( (a+b) \frac{x^n-1}{x-1} + a x \frac{ (n-1) x^{n} - n x^{n-1} + 1 }{(x-1)^2} \right) \end{eqnarray}$$

Now applying this: $$\begin{eqnarray} \sum_{k=1}^n \frac{10 k -5}{2^{k+2}} &=& \frac{5}{4} \sum_{k=1}^n (2k-1)\left(\frac{1}{2}\right)^k \\ &=& \frac{5}{4} \frac{1}{2} \left( -(2^{1-n} - 2) + (n-1) 2^{2-n}- n 2^{1-n} + 4 \right) \\ &=& \frac{5}{4} \left( 3 + (n-3) 2^{-n} \right) \end{eqnarray}$$

-
Thanks for doing this in general form. If you don't mind I'll use this question for duplicates in the future and point to this answer :-) –  joriki Nov 13 '11 at 8:04
@joriki:Question is tagged as algebra-precalculus. –  Quixotic Nov 18 '11 at 7:31
@MaX: I see. Thanks for pointing that out. Fortunately there are so many answers here, including N.S.' that shows an elementary way to sum $i/q^i$, that it will still be a good duplicate in many future circumstances. I wonder which answer you'll be accepting... –  joriki Nov 18 '11 at 7:39
@joriki:You are welcome, I am accepting Michael Lugo's answer as it provides the fastest method to reach the solution. –  Quixotic Nov 19 '11 at 14:17
You presented this beautifully. Thank you. –  000 Jul 14 '12 at 9:48

First note that $\displaystyle\frac{10i-5}{2^{i+2}} = \frac{5(2i-1)}{2^{i+2}}$

Secondly, using the sum of a geometric series you can show that $2^0 + 2^1 + 2^2 + ... + 2^k = 2^{k+1}-1$.

\displaystyle \begin{align*} \text{So } \sum \limits_{i=1}^{n} \frac{10i-5}{2^{i+2}} &= 5(\frac{2\times1-1}{2^{1+2}}+\frac{2\times2-1}{2^{2+2}}+\frac{2\times3-1}{2^{3+2}}+...+\frac{2\times n-1}{2^{n+2}})\\ &= 5(\frac{2^{n-1}(2\times1-1)+2^{n-2}(2\times2-1)+2^{n-3}(2\times3-1)+...+2^{0}(2\times n-1)}{2^{n+2}}) \\ &= 5(\frac{2(2^{n-1}\times1+2^{n-2}\times2+2^{n-3}\times3+...+2^{0}\times n)-(2^{n-1}+2^{n-2}+2^{n-3}+...+1)}{2^{n+2}})\\ &= 5(\frac{2(2^{n-1}\times1+2^{n-2}\times2+2^{n-3}\times3+...+2^{0}\times n)-(2^n-1)}{2^{n+2}})\\ &= 5(\frac{2((2^{n-1}+2^{n-2}+2^{n-3}+...+1)+(2^{n-2}+2^{n-3}+2^{n-4}+...+1)+...+(2+1)+(1))-(2^n-1)}{2^{n+2}})\\ &= 5(\frac{2((2^{n}-1)+(2^{n-1}-1)+(2^{n-2}-1)+...+(2^{2}-1)+(2-1))-(2^n-1)}{2^{n+2}})\\ &= 5(\frac{2((2^{n}+2^{n-1}+2^{n-2}+...+2) + (-1)\times n)-(2^n-1)}{2^{n+2}})\\ &= 5(\frac{2(2\times (2^n - 1))- n)-(2^n-1)}{2^{n+2}})\\ &= 5(\frac{4 \times 2^n - 4 - 2n -2^n + 1}{2^{n+2}})\\ &= 5(\frac{3 \times 2^n - 2n - 3}{2^{n+2}})\text{ which is the closed form you got from Mathematica}\end{align*}

-
The equations are a lot more readable in display style, which you get either by switching it on individually with \displaystyle or by making the entire formula a displayed one by enclosing it in double dollar signs. Also note that you can use the eqnarray and align environments to align consecutive equations with each other. –  joriki Nov 13 '11 at 8:03
@joriki Thanks for the tips and I think my answer has been formatted correctly but I believe my 5th line is a tad too long? I had to trim is down a bit and it is still quite long... –  Sp3000 Nov 13 '11 at 9:50
Yes, that's a problem actually, which I didn't foresee when I wrote my comment :-) You can alleviate it somewhat by not putting the "So" into the equation but on a line of its own. Also, though it looks nicer with a full equation in the first line, in this case you could break the line before the first equals sign; it will still look better with eqnarray since you can align the expression in the first line with the other expressions instead of with the equals signs. –  joriki Nov 13 '11 at 10:03

The sum $S= \sum \limits_{i=1}^n \frac{1}{2^i}=1-\frac{1}{2^n}$ is geometric, thus easy to calculate.

Here is a simple elementary way of calculating

$$T=\sum_{i=1}^n \frac{i}{2^i} \,.$$:

$$T=\sum_{i=1}^n \frac{i}{2^i} =\frac{1}{2}+ \sum_{i=2}^n \frac{i}{2^i} =\frac{1}{2}-\frac{n+1}{2^{n+1}}+ \sum_{i=2}^{n+1} \frac{i}{2^i} \,.$$

Changing the index in the last sum yields:

$$T= \frac{2^n-n-1}{2^{n+1}}+\sum_{i=1}^{n} \frac{i+1}{2^{i+1}}=\frac{2^n-n-1}{2^{n+1}}+\sum_{i=1}^{n} \frac{i}{2^{i+1}}+\sum_{i=1}^{n} \frac{1}{2^{i+1}} \,.$$

Thus

$$T= \frac{2^n-n-1}{2^{n+1}}+\frac{1}{2}T+ \frac{1}{2}-\frac{1}{2^{n+1}}$$

Thus

$$\frac{1}{2}T=\frac{2^{n+1}-n-2}{2^{n+1}}\,.$$

Hence

$$\sum_{i=1}^n \frac{i}{2^i} =\frac{2^{n+1}-n-2}{2^{n}} \,.$$

-

$\sum \limits_{i=1}^{10} \frac{10i-5}{2^{i+2}} =\frac{10}{4} \sum_{i=1}^{10} \frac{i}{2^i}-\frac{5}{4}\sum_{i=1}^{10} \frac{1}{2^i}$

Second $\sum$ is obviously $1-\frac{1}{1024}$.

First $\sum$:

$\frac{1}{2} +$

$\frac{1}{4} + \frac{1}{4} +$

$\frac{1}{8} + \frac{1}{8} + \frac{1}{8} +$

$\vdots$

$\frac{1}{1024} + \frac{1}{1024} + \dots + \frac{1}{1024}$

Summing by columns, $(1-\frac{1}{1024})+(\frac{1}{2}-\frac{1}{1024})+\dots+(\frac{1}{512}-\frac{1}{1024})=(1+\frac{1}{2}+\dots+\frac{1}{512})-\frac{10}{1024}=\frac{1023}{512}-\frac{10}{1024}$

Rest is boring and easy.

-


# Ring of polynomials as a module over symmetric polynomials

Consider the ring of polynomials $\mathbb{k} [x_1, x_2, \ldots , x_n]$ as a module over the ring of symmetric polynomials $\Lambda_{\mathbb{k}}$. Is $\mathbb{k} [x_1, x_2, \ldots , x_n]$ a free $\Lambda_{\mathbb{k}}$-module? Can you write down "good" generators explicitly? (I think that it has to be something very classical in representation theory).

Comment: My initial question was whether this module flat. But since all flat Noetherian modules over polynomial ring are free (correct me if it is wrong), it is the same question.

There is much more general question, which seems unlikely to have good answer. Let $G$ be a finite group and $V$ finite dimensional representation of G. Consider projection $p: V \rightarrow V/G$. When is $p$ flat?

• – anon Nov 3 '14 at 20:52
• Sorry. I really tried to find something before asking and did not manage. – quinque Nov 3 '14 at 21:56

Let $s_i= \sum x_1 \ldots x_i$ be the fundamental symmetric polynomials. We have a sequence of free extensions $$k[s_1, \ldots, s_n] \subset k[s_1, \ldots, s_n][x_1]\subset k[s_1, \ldots, s_n][x_1][x_2] \subset \cdots \\ \subset k[s_1,\ldots ,s_n] [x_1] \ldots [x_n] = k[x_1, \ldots ,x_n]$$ of degrees $n$, $n-1$, $\ldots$ ,$1$. At step $i$ the generators are $1, x_i, \ldots, x_i^{n-i}$. Therefore $$k[s_1, \ldots, s_n] \subset k[x_1, \ldots, x_n]$$ is free of degree $n!$ with generators $x_1^{a_1} x_2^{a_2} \cdots x_n^{a_n}$ with $0 \le a_i \le n-i$.

More generally for a finite reflection group of transformations $G$ acting on a vector space $V$ over a field $k$ of characteristic $0$ (to be safe) the algebra of invariants $k[V]^G$ is a polynomial algebra and $k[V]$ is a free $k[V]^G$ module of rank $|G|$ --see the answer of @stephen: .

• I think some more details are in order: why $1,x_1,\dots,x_1^{n-1}$ is a basis of the first ring extension? – user26857 Nov 3 '14 at 19:41
• And why don't satisfy any equation of degree $<n$? – user26857 Nov 3 '14 at 19:50
• @user26857: Another useful observation using just basic Galois theory is : $k(s_1, \ldots, s_n) \subset k(x_1, \ldots, x_n)$ is Galois with group $S_n$. – orangeskid Nov 3 '14 at 19:57
• Great answer! Just a remark: The basis orangeskid describes is different from the Schubert basis - geometrically, the images of the $x_i$ in the integral cohomology of the flag variety are the Chern classes of the $n$ tautological line bundles (and the iterated computation above has a geometric counteprart, by viewing the flat variety as an iterated projective bundle and using Leray-Hirsch at each step), while as I said above the Schubert polynomials correspond to Bruhat cells. – Hanno Nov 3 '14 at 20:02
• Regarding your last paragraph, it can certainly happen that in characteristic $p$ the ring of invariants is not polynomial even when the group is generated by reflection; on the other hand polynomials invariants is enough to imply that the group is generated by reflections in any characteristic. – Stephen Nov 3 '14 at 20:34

Yes, that's indeed a classical result of representation theory: ${\mathbb Z}[x_1,...,x_n]$ is graded free over ${\Lambda}_n$ of rank $n!$ (the graded rank is the quantum factorial $[n]_q!$), and a basis is given by Schubert polynomials defined in terms of divided difference operators.

See for example the original article of Demazure, in particular Theorem 6.2.

Passing to the quotient, one obtains the graded ring ${\mathbb Z}[x_1,...,x_n]/\langle\Lambda_n^+\rangle$ which is isomorphic to the integral cohomology ring of the flag variety of ${\mathbb C}^n$, and the ${\mathbb Z}$-basis of Schubert polynomials coincides with the basis of fundamental classes of Bruhat cells in the flag variety. This is explained in Fulton's book 'Young Tableaux', Section 10.4.

The answer by @orangeskid (+1) is the most classical and direct, and the answer by @Hanno connects your question to Schubert calculus and the geometry of flag varieties (+1). Hoping this isn't too self-promoting, you might also have a look at my paper Jack polynomials and the coinvariant ring of $G(r,p,n)$ (I worked in somewhat more generality)

http://tinyurl.com/l8u9wh5

where I showed that certain non-symmetric Jack polynomials give a basis as well (I was working with more general reflection groups and over the complex numbers, but a version should work over any field of characteristic $0$; I have not thought much about this in characteristic $p$). The point of my paper was really to connect the descent bases (yet another basis!) studied much earlier by Adriano Garsia and Dennis Stanton in the paper Group actions of Stanley-Reisner rings and invariants of permutation groups

http://tinyurl.com/lhhtney

to the representation theoretic structure of the coinvariant algebra as an irreducible module for the rational Cherednik algebra. Of course this structure becomes much more complicated in characteristic smaller than $n$; in particular the coinvariant algebra will in general not be irreducible as a module for the Cherednik algebra.

Towards your second question: by definition $p$ is flat if and only if $k[V]$ is a flat $k[V]^G$-module. This certainly holds if $k[V]$ is free over $k[V]^G$; a sufficient condition for this is given in Bourbaki, Theorem 1 of section 2 of Chapter 5 of Lie Groups and Lie algebras (page 110): in case the characteristic of $k$ does not divide the order of $G$, it suffices that $G$ be generated by reflections. This is false (in general) in characteristic dividing the order of the group. But see the paper Extending the coinvariant theorems of Chevalley, Shephard-Todd, Mitchell, and Springer by Broer, Reiner, Smith, and Webb available for instance on Peter Webb's homepage here

http://www.math.umn.edu/~webb/Publications/

for references and what can be said in this generality (this is an active area of research so you shouldn't expect to find a clean answer to your question).

Conversely, assuming $p$ is flat and examining the proof of the above theorem in Bourbaki, it follows that $k[V]$ is a free $k[V]^G$-module. Now Remark 2 to Theorem 4 (page 120) shows that $G$ is generated by reflections. So to sum up: if $p$ is flat then $G$ is generated by reflections; in characteristic not dividing the order of $G$ the converse holds.

• MO level, neat. +1! – orangeskid Nov 3 '14 at 20:00
• I have a problem about your links. Article by Webb and others is just about connected topics. They do not answer my question (or I just do not see it, then please explain). About Bourbaki book I have a deeper trouble. It sounds silly but I even can not find what is called theorem 1 in this section. Could you post here what it is about (proof is not necessary). – quinque Nov 3 '14 at 23:32
• @user167762, The statement is Theorem 1 on page 110 of my English edition---are you able to locate it now? I referenced the paper of of BRSW not because it answers your question, but because it is the most recent thing I can think of that deals with the subject in detail and I thought the references it contained might prove useful for you or other future readers. I will edit my answer a bit to give an indication of what I believe to be the state of the art. As far as I know, in positive characteristic there is no clean characterization of groups such that the projection is flat. – Stephen Nov 4 '14 at 12:26

Another perspective:

The ring extension $S=k[s_1,\dots,s_n]\subset k[x_1,\dots,x_n]=R$ is finite, and since $R$ is Cohen-Macaulay then it is free of rank say $m$. We thus have a Hironaka decomposition $R=\oplus_{i=1}^m S\eta_i$ for some homogeneous $\eta_i\in R$. Using this the Hilbert series of $R$ is $$H_R(t)=\sum_{i=1}^mH_S(t)t^{\deg\eta_i}=\sum_{i=1}^mt^{\deg\eta_i}/\prod_{i=1}^n(1-t^i).$$ On the other side, $H_R(t)=1/(1-t)^n$ and therefore $\sum_{i=1}^mt^{\deg\eta_i}=\prod_{i=1}^{n-1}(1+t+\cdots+t^i)$ which for $t=1$ gives $m=n!$.

• You used a theorem about Cohen-Macaulay. I do not know it. Could you please write it? – quinque Nov 3 '14 at 22:26


# Equation of one branch of a hyperbola in general position

Given a generic expression of a conic:

$$Ax^2 + Bxy + Cy^2 + Dx + Ey + F=0$$

is there a way to write an expression for one of the branches as a function of the coefficients? I tried using the quadratic formula to get an expression for $y$: $$y=\frac{-(Bx+E)\pm \sqrt{(Bx+E)^2 - 4(C)(Ax^2 + Dx + F)}}{2C}$$

but this doesn't always work. Consider:

$$xy=1$$

Here, $A=0, B=1, C=0, D=0, E=0, F=0$, so $y=\frac{\cdot}{0}$, which isn't particularly helpful. In other cases it is not as bad, but still not what I'm looking for. E.g.

$$x^2 - y^2 - 1=0$$

Using the formula above, we get $$y=\pm \sqrt{x^2-1}$$ which seems nice, but $y=\sqrt{x^2-1}$ it is actually one half of each branch rather than one entire branch, as can be seen here.

http://www.wolframalpha.com/input/?i=plot%28x^2+-+y^2+-+1%3D0%29

http://www.wolframalpha.com/input/?i=plot%28y%3Dsqrt%28x^2-1%29%29

I am trying to draw one of these branches, so I need an ordered set of points along a predefined "grid" of either of the variables. Is it possible to do this?

-
Your equation doesn't work for all hyperbolas since you found it as a solution of quadratic equation. For $xy = 1$ it won't work since it's not quadratic equation. You can't solve $0x^2+2x+1=0$ as quadratic equation, since it's not. –  Kaster Mar 7 '13 at 23:56

First of all, if you want to draw a portion of the hyperbola, you typically just need parametric equations of the form $x = x(t)$, $y = y(t)$; you don't necessarily need to get $y$ as a function of $x$.

But, ignoring that quibble, I'll try to answer the question you asked.

The key is to first eliminate the $xy$ term in the implicit equation. In effect, you do this by rotating the coordinate system. This is really the same idea as Will Jagy used in his answer, but it might be easier to understand if I don't mention eigenvectors.

Suppose we introduce a $uv$ cooordinate system that is rotated by an angle $\theta$ (counterclockwise) from the $xy$ one. Then we have

$$x = u\cos\theta - v\sin\theta \quad ; \quad y = u\sin\theta + v\cos\theta$$

You can plug these $x$ and $y$ expressions into your original equation, and you'll get

$$\bar A u^2 + \bar B uv + \bar C v^2 + \bar Du + \bar Ev + \bar F = 0$$

where

$$\bar A = A \cos^2\theta + 2B \sin \theta\cos\theta + C \sin^2\theta$$

$$\bar B = 2 B \cos 2\theta - (A - C) \sin 2\theta$$

$$\bar C = A \sin^2\theta - 2B \sin\theta\cos\theta + C \cos^2\theta$$

and so on. Now we just have to cleverly choose $\theta$ so that the $uv$ term disappears. Clearly, we'll get what we want if we choose $\theta$ so that $\bar B = 0$, and this means

$$\tan2\theta = \frac{2B}{A - C}$$

After using this technique, we can now assume that the equation has the form

$$a u^2 + c v^2 - 2adu - 2cev + f = 0$$

Note that I'm using $-2ad$ in place of $\bar D$ and $-2ce$ in place of $\bar E$, just to make the next step more convenient. And the next step is just some "complete the square" tricks. The equation can be written:

$$a (u^2 - 2du) + c (v^2 - 2ev) + f = 0$$

In other words:

$$a (u^2 - 2du + d^2) + c (v^2 - 2ev + e^2) + f - ad^2 - ce^2 = 0$$

which is

$$a (u - d)^2 + c (v - e)^2 = ad^2 + ce^2 - f$$

Now it should be clear that we have either an ellipse (if the signs of $a$ and $c$ are the same) or a hyperbola (if the signs are different). I'm ignoring the parabola case and several degenerate cases. The ellipse/hyperbola has its center at the point $(d,e)$ in the $uv$ coordinate system, and its axes of symmetry are parallel to the $u$ and $v$ axes.

At this point, if our curve turns out to be a hyperbola, you can use standard parametric equations (like the ones Wil Jagy gave) to trace out one branch or the other.

-

I think you are going to have a more satisfactory experience doing this: find the center $\vec{P} = (x_0, y_0)$ of your hyperbola. Find the eigenvectors of the matrix $$\left( \begin{array}{cc} A & B/2 \\ B/2 & C \end{array} \right)$$ and normalize and choose order and $\pm$ so that with basis $\vec{u},\vec{v}$ you can then write your branch as $$g(t) = \vec{P} + \vec{u} \cosh t + \vec{v} \sinh t.$$ Note that while $\vec{u},\vec{v}$ are perpendicular to each other they are not particularly of any length, in the way I write it above. If you prefer an orthonormal basis you then just put one constant scalar multiplication in front of the $\cosh$ term and one in front of the $\sinh$ term. It will all work out if you actually do have a hyperbola, which happens when $B^2 > 4 A C.$

I did teach this about 20 years ago, a whole section on translations and rotations of conic sections for a engineering calculus course. The memories are dim, but it does appear that it is best to find an orthonormal basis for the above matrix first, then find the center expressed in that basis, and end up with constant scalar coefficients of the hyperbolic trig terms.

-
I posted an answer following your suggestion with an example. The only part I didn't follow was "and normalize and choose order and $\pm$ so that with the new basis you can then write your branch as...". What do you mean "choose order" and "choose $\pm$"? Also, how do you determine the values of the parameter that constitute each branch? –  David Doria Mar 8 '13 at 13:31

Following Will Jagy's suggestion, here are some examples:

Example #1

Consider

$$x^2 - y^2 -1 = 0$$

($A=1$, $B=0$, $C=-1$, $D=0$, $E=0$, $F=-1$). From

$$p_c = \begin{pmatrix}x_c\\y_c\end{pmatrix} = \begin{pmatrix}\frac{BE-2CD}{4AC-B^2}\\ \frac{DB-2AE}{4AC-B^2}\end{pmatrix}$$

we have

$$p_c = \begin{pmatrix}0\\0\end{pmatrix}$$

Now, the eigenvalues/vectors of the matrix $$\begin{pmatrix}A & \frac{B}{2}\\\frac{B}{2} & C\end{pmatrix} = \begin{pmatrix}1 & 0 \\ 0 & -1 \end{pmatrix}$$ are $\lambda_1 = -1$, $\lambda_2 = 1$, $v_1 = \begin{pmatrix}0\\1\end{pmatrix}$, $v_2 = \begin{pmatrix}1\\0\end{pmatrix}$

From the parametric form

$$g(t)=p_c + v_1 cosh(t) + v_2 sinh(t)$$

we have

$$g(t) = \begin{pmatrix}0\\1\end{pmatrix} cosh(t) + \begin{pmatrix}1\\0\end{pmatrix} sinh(t)$$

which looks like

Now how would we draw the other branch? That is, how do you determine the values of the parameter that constitute each branch?

Example #2

Consider

$$7x^2 - 3y^2 - 25 = 0$$

($A=7$, $B=0$, $C=-3$, $D=0$, $E=0$, $F=-25$). From

$$p_c = \begin{pmatrix}x_c\\y_c\end{pmatrix} = \begin{pmatrix}\frac{BE-2CD}{4AC-B^2}\\ \frac{DB-2AE}{4AC-B^2}\end{pmatrix}$$

we have

$$p_c = \begin{pmatrix}0\\\frac{-25}{6}\end{pmatrix}$$

Now, the eigenvalues/vectors of the matrix $$\begin{pmatrix}A & \frac{B}{2}\\\frac{B}{2} & C\end{pmatrix} = \begin{pmatrix}7 & 0 \\ 0 & -3 \end{pmatrix}$$ are $\lambda_1 = -3$, $\lambda_2 = 7$, $v_1 = \begin{pmatrix}0\\1\end{pmatrix}$, $v_2 = \begin{pmatrix}1\\0\end{pmatrix}$

From the parametric form

$$g(t)=p_c + v_1 cosh(t) + v_2 sinh(t)$$

we have

$$g(t) = \begin{pmatrix}0\\ \frac{-25}{6}\end{pmatrix} + \begin{pmatrix}0\\1\end{pmatrix} cosh(t) + \begin{pmatrix}1\\0\end{pmatrix} sinh(t)$$

-
David, the other branch is $p_c -v_1 \cosh t + v_2 \sinh t$ –  Will Jagy Mar 8 '13 at 20:51
David, please do another example, something along the lines of $x^2 - x y - y^2 =1,$ where the eigenvectors will not naturally come out length one, and if you choose an orthonormal basis you will need scalar multiples, $p_c + \alpha v_1 \cosh t + \beta v_2 \sinh t.$ Note that the bit about the scalar multipliers would apply even for, say, $7 x^2 - 3 y^2 = 25,$ where one branch is $$x = \frac{5}{\sqrt 7} \cosh t, y = \frac{5}{\sqrt 3} \sinh t.$$ –  Will Jagy Mar 8 '13 at 21:04
@WillJagy How do you choose the eigenvector that goes with cosh vs sinh? Even in my Example #1, the hyperbola opens up/down (instead of left/right) if I use x=sinh(t) and y=cosh(t) as the eigenvectors they way I have written them imply (I guess I thought I had made a typo so I switched them (x=cosh(t) and y=sinh(t) when I produced that graph): wolframalpha.com/input/… –  David Doria Mar 11 '13 at 12:04
@WillJagy I worked out the $7x^2 - 3y^2 - 25 = 0$ example in my answer. How did you get from where I am to the $\frac{5}{\sqrt{7}}$ and $\frac{5}{\sqrt{3}}$ coefficients? And did you just accidentally omit the $center + ...$ term? My comment above holds on this problem as well - how do you choose the eigenvector to associate with the cosh vs sinh term? –  David Doria Mar 11 '13 at 12:11
The center is actually at $(0,0)$ because $D=0,E=0.$ If you choose unit length eigenvectors, then you expect scalar coefficients to be necessary. In particular, try your recipe at $t=0$ (after replacing the -25/6 by 0) and you will find the point does not lie on the actual hyperbola. How about if you try doing $xy = 1?$ You already know exactly how the graph looks. One test for correctness is, once you write $x = x_c + x_1 \cosh t + x_2 \sinh t,$ then $y = y_c + y_1 \cosh t + y_2 \sinh t,$ you must be able to plug those into the original equation and get truth. –  Will Jagy Mar 11 '13 at 20:38


# Proof $1+2+3+4+\cdots+n = \frac{n\times(n+1)}2$

Apparently $$1+2+3+4+\ldots+n = \dfrac{n\times(n+1)}2$$.

How? What's the proof? Or maybe it is self apparent just looking at the above?

PS: This problem is known as "The sum of the first $$n$$ positive integers".

• This an important example of a finite integral, a good tutorial here: stanford.edu/~dgleich/publications/finite-calculus.pdf – anon Aug 12 '10 at 19:46
• Note that we do not define this sum to be (x+1)x/2, we prove it to be so. It is a very useful formula. You could check out en.wikipedia.org/wiki/Triangle_number, which unfortunately, does not prove the formula you cite. – Ross Millikan Apr 21 '11 at 22:14
• Although we already have three proofs of this here, I think it would be really interesting if we amassed more (perhaps excluding the typical intro-to-induction styled proof). – davidlowryduda Apr 22 '11 at 1:15
• It could be proved by mathematical induction – J. W. Tanner Sep 5 '19 at 1:10
• Not appropriate for an answer, but you've asked either a very easy or a very difficult question. If by "why" you mean, "Can I see a proof of this fact?" the question is fairly easy to answer. If by "why" you mean, "Why should this be true?" you've asked a very deep kind of question that mathematicians make entire careers out of. Sure it can be shown to be true, but how does it connect to other true results? Why is it a polynomial of degree $2$? What about the sum of $k^2$? And on and on... – Charles Hudgins Sep 5 '19 at 3:05

Let $$S = 1 + 2 + \ldots + (n-1) + n.$$ Write it backwards: $$S = n + (n-1) + \ldots + 2 + 1.$$ Add the two equations, term by term; each term is $$n+1,$$ so $$2S = (n+1) + (n+1) + \ldots + (n+1) = n(n+1).$$ Divide by 2: $$S = \frac{n(n+1)}{2}.$$

• Well, you lost me at "each term is n+1...". As far as I can see, if you add the two equations term by term it will be: n+n + (n-1)+(n-1) + ... + 2+2 + 1+1. How did you get (n+1) + (n+1) + ... + (n+1)? – b1_ Aug 12 '10 at 18:27
• I got it! It's 2S = (1+2+...+(n-1)+n) + (n+(n-1)+...+2+1) - so you write one backwards, then match up each term. 2S = (1+n) + (2+n-1)+...+(n-1+2)+n+1, and so 2S=(n+1)+(n+1)+...+(n+1)+(n+1) etc – b1_ Aug 12 '10 at 19:04
• This trick is usually attributed to Gauss (when he was a schoolboy... though it's unclear if the story is true or not). – Fixee Feb 27 '11 at 15:17
• This helped make it clear for me youtu.be/1wnIsgUivEQ – vexe Nov 27 '15 at 8:17
• @john this can be made rigorous using sigma notation. It's simply a change of index. – Brevan Ellefsen Jul 29 '18 at 1:34

My favourite proof is the one given here on MathOverflow. I'm copying the picture here for easy reference, but full credit goes to Mariano Suárez-Alvarez for this answer.

Takes a little bit of looking at it to see what's going on, but it's nice once you get it. Observe that if there are n rows of yellow discs, then:

1. there are a total of 1 + 2 + ... + n yellow discs;
2. every yellow disc corresponds to a unique pair of blue discs, and vice versa;
3. there are ${n+1 \choose 2} = \frac 12 n(n+1)$ such pairs.
• great proof!!!! – anon Aug 12 '10 at 21:22
• Maybe I lack imagination, but to me it's clearer to just make a square of yellow discs ($n^2$ of them), duplicate the diagonal ($n^2+n$), then cut in half to get the answer ($(n^2+n)/2$). This is how Knuth does this (and much more intricate) summations in "Concrete Mathematics." – Fixee Feb 27 '11 at 15:27
• @Fixee: I don't know why you're comparing them; this is an entirely different proof. Unlike the other proof (also good), this doesn't require computing areas, cutting, or duplicating -- in fact this doesn't even involve the number $n(n+1)/2$ directly; what this gives is a proof that $1 + 2 + \dots + n = \binom{n+1}{2}$, and it so happens that the latter is $n(n+1)/2$. It's a bijection proof, rather than an area proof (vaguely speaking). – ShreevatsaR Nov 25 '11 at 6:13
• @Vaughn Climenhaga - is there an analog of this in three dimensions and higher? – Vincent Tjeng Apr 1 '13 at 9:43
• Wow. That is simply amazing. I didn't get it at first glance and then it hit me. Ingenious. – Karl Feb 3 '16 at 20:30

What a big sum! This is one of those questions that have dozens of proofs because of their utility and instructional use. I present my two favorite proofs: one because of its simplicity, and one because I came up with it on my own (that is, before seeing others do it - it's known).

The first involves the above picture:

In short, note that we want to know how many boxes are in the outlined region, as the first column has 1 box, the second 2, and so on (1 + 2 + ... + n). One way to count this quickly is to take another copy of this section and attach it below, making a $n*(n+1)$ box that has exactly twice as many squares as we actually want. But there are $n*(n+1)$ little squares in this area, so our sum is half that: $$1 + 2 + ... + n = \dfrac{n(n+1)}{2}.$$

Second proof, same as the first but a little bit harder and a little bit worse:

Let us take for granted the finite geometric sum $1 + x + x^2 + ... + x^n = \dfrac{x^{n+1} - 1}{x-1}$ (If you are unfamiliar with this, comment and I'll direct you to a proof). This is a polynomial - so let's differentiate it. We get $$1 + 2x + 3x^2 + ... + nx^{n-1} = \dfrac{ (n+1)x^n (x-1) - x^{n+1} + 1}{ (x-1)^2 }$$ Taking the limit as x approaches 1, we get

$$\lim_{x \to 1} \dfrac{ (n+1)x^n (x-1) - x^{n+1} + 1}{ (x-1)^2} = \dfrac{ (n+1) [ (n+1)x^n - nx^{n-1} ] - (n+1)x^n }{2(x-1)} =$$ $$\lim_{x \to 1} \dfrac{ (n+1)[(n+1)(n)x^{n-1} - n(n-1)x^{n-2}] - (n+1)(n)x^{n-1} } {2}$$

where we used two applications of l'Hopital above. This limit exists, and plugging in x = 1 we see that we get $$\dfrac{1}{2} * (n+1)(n) [ (n+1) - (n-1) - 1] = \dfrac{ (n)(n+1)}{2}.$$

And that concludes the second proof.

• I came up with the first proof by myself a long time ago :). It was an awesome moment where the concept of "area" was redefined. – Jacob Apr 22 '11 at 1:50
• @mixedmath A bit overkill, but nice anyways. (+1) – Franklin Pezzuti Dyer Jan 20 '18 at 15:40

How many ways are there to choose a $2$-element subset out of an $n$-element set?

On the one hand, you can choose the first element of the set in $n$ ways, then the second element of the set in $n-1$ ways, then divide by $2$ because it doesn't matter which you choose first and which you choose second. This gives $\frac{n(n-1)}{2}$ ways.

On the other hand, suppose the $n$ elements are $1, 2, 3, ... n$, and suppose the larger of the two elements you choose is $j$. Then for every $j$ between $2$ and $n$ there are $j-1$ possible choices of the smaller of the two elements, which can be any of $1, 2, ... j-1$. This gives $1 + 2 + ... + (n-1)$ ways.

Since the two expressions above count the same thing, they must be equal. This is known as the principle of double counting, and it is one of a combinatorialist's favorite weapons. A generalization of this argument allows one to deduce the sum of the first $n$ squares, cubes, fourth powers...

Gathering as many proofs as we can? Write the series recursively:

$$S(n) = S(n - 1) + n \tag{1}$$

Substitute $n \to n+1$ :

$$S(n + 1) = S(n) + n + 1\tag{2}$$

Equation (2) subtract Equation (1):

$$S(n+1) - S(n) = S(n) + 1 - S(n - 1) \tag{3}$$

And write it up:

$$\begin{cases} S(n+1) &= 2S(n) -S(n-1) + 1 \\ S(n) &= S(n) \end{cases} \tag{4}$$

Which can now be written in matrix form:

$$\begin{bmatrix} S(n+1) \\ S(n) \end{bmatrix} = \begin{bmatrix} 2 & -1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} S(n) \\ S(n-1) \end{bmatrix} + \begin{bmatrix} 1 \\ 0 \end{bmatrix} \tag{5}$$

And then converting the affine equation (5) to the linear equation (6):

$$\begin{bmatrix} S(n+1) \\ S(n+0) \\ 1\end{bmatrix} = \begin{bmatrix} 2 & -1 & 1 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{bmatrix} \begin{bmatrix} S(n) \\ S(n-1) \\ 1\end{bmatrix} \tag{6}$$

And closing the equation:

$$\begin{bmatrix} S(n+1) \\ S(n) \\ 1\end{bmatrix} = \begin{bmatrix} 2 & -1 & 1 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{bmatrix}^n \begin{bmatrix} S(1) \\ S(0) \\ 1\end{bmatrix} \tag{6}$$

Then finding the Jordan form of the 3x3 matrix:

\begin{align} \begin{bmatrix} S(n+1) \\ S(n) \\ 1\end{bmatrix} &= \left(\begin{bmatrix} 1 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{bmatrix} \begin{bmatrix} 1 & 1 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 1\end{bmatrix} \begin{bmatrix} 1 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{bmatrix}^{-1}\right)^n \begin{bmatrix} S(1) \\ S(0) \\ 1\end{bmatrix} \\ &= \begin{bmatrix} 1 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{bmatrix} \begin{bmatrix} 1 & 1 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 1\end{bmatrix}^n \begin{bmatrix} 1 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{bmatrix}^{-1} \begin{bmatrix} S(1) \\ S(0) \\ 1\end{bmatrix} \\ &= \begin{bmatrix} 1 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{bmatrix} \begin{bmatrix} 1 & \binom{n}{1} & \binom{n-1}{2} \\ 0 & 1 & \binom{n}{1} \\ 0 & 0 & 1\end{bmatrix} \begin{bmatrix} 0 & 1 & 0 \\ 1 & -1 & 0 \\ 0 & 0 & 1\end{bmatrix} \begin{bmatrix} S(1) \\ S(0) \\ 1\end{bmatrix} \end{align} \tag{7}

And multiplying the matrices out:

$$\begin{bmatrix} S(n+1) \\ S(n) \\ 1\end{bmatrix} = \begin{bmatrix} \frac{ (2n+2)S(1) - 2nS(0) + {n}^{2} + n}{2} \\ \frac{ 2nS(1) + (2 - 2n)S(0)+{n}^{2}-n}{2} \\ 1 \end{bmatrix} \tag{8}$$

And given that $S(0) = 0$ and $S(1) = 1$, we get that:

$$S(n) = \frac{n^2 + n}{2} \tag{9}$$

For example, $$X = 1+2+3+4+5+6$$ Then twice $X$ is $$2X = (1+2+3+4+5+6) + (1+2+3+4+5+6)$$ which we can rearrange as $$2X = (1+2+3+4+5+6) + (6+5+4+3+2+1)$$ and add term by term to get $$2X = (1+6)+(2+5)+(3+4)+(4+3)+(5+2)+(6+1)$$ to get $$2X = 7+7+7+7+7+7 = 6*7 = 42$$

• Legend has it that Gauss used this method to find the sum of all numbers from 1 to 100 without actually summing them. – lhf Apr 21 '11 at 22:43
• In class, I think. A teacher set him in a corner because he was misbehaving (apparently having already finished that day's work), and told him to add these numbers. Almost immediately, Gauss went to play because he was done - and when the teacher got angry it took her nearly 10 minutes to verify that his answer was correct! Or at least, that's how the legend I heard went. – davidlowryduda Apr 21 '11 at 22:46
• @mixedmath, Gauss's Day of Reckoning, which was cited in wikipedia, discusses the legend. – lhf Apr 21 '11 at 23:01
• @mixedmath: I heard a different version - teacher asked all the kids to add the numbers from 1 to 1,000, because he (late 18th century Germany, therefore "he") needed some time to do some work. And CFG had the answer within 30 seconds... – gnasher729 Dec 22 '16 at 16:56
• Nobody should take nearly ten minutes. When you add up the single digits, you should notice that you are ten times adding 1+2+3+4+5+6+7+8+9 = 45. And the tens, you have ten 10s, ten 20s, ten 30s, ten 90s. Plus a hundred. All in all, should be done in a minute. – gnasher729 Dec 22 '16 at 16:59

My favourite proof of this fact involves counting the edges of the complete graph $K_n$ in two different ways.

On the one hand, any vertex, $v_1$ say, is connected to $n-1$ other vertices, thus contributing $n-1$ edges. Moving clockwise, the next vertex $v_2$ contributes $n-2$ edges (not counting the edge connecting $v_1$ and $v_2$), $v_3$ adds $n-3$ edges, ... , $v_{n-1}$ contributes 1 edge and $v_n$ adds no new edges.

Thus the total number of edges in the complete graph $K_n$ is:

$$E = \sum\limits_{i=1}^{n-1} i$$

But clearly, any edge connects two vertices, so the number of edges is the number of ways to choose two distinct elements from the set $\{1,...,n\}$ and hence:

$$E = \sum\limits_{i=1}^{n-1} i = \binom{n}{2} = \frac{n(n-1)}{2}$$

• You can easely explain this proof without graph theory... $n+1$ people went to a party, and everyone shakes hands with everyone else... How many handshakes were there? :) – N. S. Sep 29 '12 at 14:03

Once you have a formula like this, you can prove it by induction. But that begs the question as to how you get such a formula. In this case you might ask: (a) what's the "average" term? and (b) how many terms are there?

Draw a triangular pyramid of base $n+1$. We get a unique coordinate for any of the $\sum_{i=1}^ni$ elements of the pyramid not in the bottom row by choosing two of the elements in the bottom row of $n+1$. This gives a bijection from the $\binom{n+1}{2}$ coordinate pairs to the $\sum_{i=1}^ni$ elements of the pyramid not in the bottom row.

Image from Mariano Suárez-Alvarez's answer on Math Overflow:

• @Mixedmath: No he means something quite different. A picture can be found in this MO-topic mathoverflow.net/questions/8846/proofs-without-words/8847#8847 – Myself Apr 22 '11 at 0:39
• This is a beautiful proof and doesn't seem to be getting enough appreciation, so I added the image from the MO answer to make it clearer. Feel free to remove the image if you don't want it. – ShreevatsaR Nov 25 '11 at 5:55
• @ShreevatsaR: That image is to powerful! – String Sep 25 '14 at 10:22

Basically same proof as Yoyo's, just purely combinatorial (no picture needed):

How many ways can we chose two distinct numbers between $1$ and $n+1$?

We pick first the largest, which is of the form $i+1$ for some $1 \leq i \leq n$, and then we have exactly $i$ distinct choices for the smallest one.

Thus we have $\sum_{i=1}^n i$ choices.

Here is another idea:

Using $(i+1)^2-i^2=2i+1$ we get a telescopic sum:

$$\sum_{i=1}^n 2i+1 = \sum_{i=1}^n (i+1)^2-i^2 = (n+1)^2-1=n^2+2n \,.$$

Then

$$n^2+2n= 2\left[\sum_{i=1}^n i\right] +n \,.$$

• Note that the second idea is useful for generalization in that we can find the sums of any powers is we know the sums of the powers less than. It can take a lot of work but using this method, you would be able to find 1^10 + 2^2 + ... + n^10 without too much work... – quasicompactscheme Sep 18 '11 at 15:07

If you knew of the geometric series, you would know that

$$\frac{1-r^{n+1}}{1-r}=1+r+r^2+r^3+\dots+r^n$$

If we differentiate both sides, we have

$$\frac{nr^{n+2}-(n+1)r^{n+1}+r}{(1-r)^2}=1+2r+3r^2+\dots+nr^{n-1}$$

Letting $r\to1$ and applying L'Hospital's rule on the fraction, we end up with

$$\frac{n(n+1)}2=1+2+3+\dots+n$$

HINT Pair each summand $$k$$ with its "reflection" $$n+1-k$$. This is simply a discrete analog of the method of computing the area of the triangle under the diagonal of a square by reflecting a subtriangle through the midpoint of the diagonal to form an $$n$$ by $$n/2$$ rectangle.

Like the analogous proof of Wilson's theorem, the method exploits the existence of a nontrivial symmetry. In Wilson's theorem we exploit the symmetry $$n \mapsto n^{-1}$$ which exists due to the fact that $${\mathbb F}_p^*$$ forms a group. Here we exploit a reflection through a line - a symmetry that exists due to the linear nature of the problem (which doesn't work for nonlinear sums, e.g. $$\sum n^2$$). Symmetries often lead to elegant proofs. One should always look for innate symmetries when first pondering problems.

Generally there are (Galois) theories and algorithms for summation in closed form, in analogy to the differential case (Ritt, Kolchin, Risch et al.). A very nice motivated introduction can be found in the introductory chapter of Carsten Schneider's thesis Symbolic Summation in Difference Fields.

Here is an easy way to visualize it:

Draw a rectangular grid with a height of $n$ squares and width of $n+1$ squares. Obviously it has $n(n+1)$ squares in it.

In the first row, color the leftmost square red and the other $n$ squares blue; in the second row, color the leftmost $2$ squares red and the other $n-1$ squares blue; and so forth (in the last row, there will be $n$ red squares and one blue square). Clearly, there are $\sum_{i=1}^n i$ red squares and the same number of blue squares.

Adding the red and blue squares together, we get $2 \sum_{i=1}^n i = n(n+1)$, or $\sum_{i=1}^n i = n(n+1)/2$.

Let us denote the sum as $S_1(n)$. This function must be a second degree polynomial in $n$ because the first order difference $S_1(n)-S_1(n-1)=n$ is a linear polynomial in $n$. So it suffices to construct the Lagrangian polynomial by three known points, let $(0,0), (1,1), (2,3)$.

$$S_1(n)=0\frac{(n-1)(n-2)}{(0-1)(0-2)}+1\frac{(n-0)(n-2)}{(1-0)(1-2)}+3\frac{(n-0)(n-1)}{(2-0)(2-1)}=\frac{n(n+1)}2.$$

The most general case of this is called an arithmetic progression or (finite) arithmetic series. There are many, many, many proofs. An easy one: write all the summands in a row; write them again just below, but from right to left now (so $1$ is under $n$, $2$ is under $n-1$, etc). Add them up, and figure out how it relates to the quantity you are looking for.

• Yep, that's it, write one backwards. I read this post but it didn't click - I guess I needed to write it out to see it. Thx – b1_ Aug 12 '10 at 19:43

Here are two ways to calculate this sum. First is by symmetry of another sum:

\begin{aligned} \displaystyle & \sum_{0 \le k \le n}k^2 = \sum_{0 \le k \le n}(n-k)^2 = n^2\sum_{0 \le k \le n}-2n\sum_{0 \le k \le n}k+\sum_{0 \le k \le n}k^2 \\& \implies 2n\sum_{0 \le k \le n}k = n^2(n+1) \implies \sum_{0 \le k \le n}k = \frac{1}{2}n(n+1).\end{aligned}

The second is writing it as double sum and switching the order of summation:

\begin{aligned}\displaystyle & \begin{aligned}\sum_{1 \le k \le n}k & = \sum_{1 \le k \le n}~\sum_{1 \le r \le k} = \sum_{1 \le r \le n} ~\sum_{r \le k \le n} = \sum_{1 \le r \le n}\bigg(\sum_{1 \le k \le n}-\sum_{1 \le k \le r-1}\bigg) \\& =\sum_{1 \le r \le n}\bigg(n-r+1\bigg) = n\sum_{1 \le k \le n}-\sum_{1 \le k \le n}k+\sum_{1 \le k \le n}\end{aligned} \\& \implies 2\sum_{1 \le k \le n}k = n^2+n \implies \sum_{1 \le k \le n}k = \frac{1}{2}n(n+1), ~ \mathbb{Q. E. D.} \end{aligned}

Note I started using k back on the third line for convenience because r is just a dummy vairable at this point, and our sum no longer depends on k. Note that the first trick can easily be generalised:

\begin{aligned} & \hspace{0.5in}\begin{aligned}\displaystyle \sum_{0 \le k \le n}k^{2p} &= \sum_{0 \le k \le n}(n-k)^{2p} \\& = \sum_{0 \le k \le n}~\sum_{0 \le r \le 2p}\binom{2p}{r}n^r(-1)^{2p-r}k^{2p-r}\\& = \sum_{0 \le k \le n}k^{2p}-2pn\sum_{0 \le k \le n}k^{2p-1}+\sum_{0 \le k \le n}~\sum_{2 \le r \le 2p}\binom{2p}{r}n^r(-1)^{2p-r}k^{2p-r} \end{aligned} \\& \implies \sum_{0 \le k \le n}k^{2p-1} = \frac{1}{2pn}\sum_{0 \le k \le n}~\sum_{2 \le r \le 2p}\binom{2p}{r}n^r(-1)^{2p-r}k^{2p-r}. \end{aligned}

You can take the power series

$$f(x)=\sum_{n=0}^\infty\left(\sum_{j=0}^{n}j\right)x^n$$

and you can check that it has a postive convergence ratio, and changing the order of the series you can deduce that

$$f(x)=\frac{x}{(1-x)^3}.$$

On the other hand the taylor series for $\frac{x}{(1-x)^3}$ is precisely

$$\frac{x}{(1-x)^3}=\sum_{n=0}^\infty \frac{n(n+1)}{2}x^n$$

so $$\sum_{j=0}^nj=\frac{n(n+1)}{2}.$$

$\dfrac{k+1}2-\dfrac{k-1}2=1 \implies\dfrac{k(k+1)}2-\dfrac{(k-1)k}2=k$

$\implies \sum_{k=1}^n\Bigg(\dfrac{k(k+1)}2-\dfrac{(k-1)k}2\Bigg)=\sum_{k=1}^nk\implies\dfrac{n(n+1)}2-\dfrac{1(1-1)}2=\sum_{k=1}^nk$

$\implies\sum_{k=1}^nk=\dfrac{n(n+1)}2$

$$\sum_{i=0}^ni-\sum_{i=0}^{n-1}i=S_1(n)-S_1(n-1)=n,$$ so that $S_1(n)$ must be a polynomial of the second degree in $n$. By the method of undeterminate coefficients, noting that there is no constant term as $S_1(0)=0$: $$S_1(n)-S_1(n-1)=n=(an^2+bn)-(a(n-1)^2+b(n-1))=\\=2an+b-a,$$ and by identification $$a=b=\frac12.$$ $$S_1(n)=\frac{n^2+n}2.$$ Let us generalize to the sum of squares, $$S_2(n)-S_2(n-1)=n^2=(an^3+bn^2+cn)-(a(n-1)^3+b(n-1)^2+c(n-1))=\\=3an^2+(-3a+2b)n+a-b+c,$$ giving $$a=\frac13,b=\frac12,c=\frac16.$$ $$S_2(n)=\frac{2n^3+3n^2+n}6.$$ For any power, you get a triangular system of equations where you recognize a part of Pascal's triangle, with alternating signs, as in the sum of cubes: $$S_3(n)-S_3(n-1)=n^3=4an^3+(-6a+3b)n^2+(4a-3b+2c)n+(-a+b-c+d),$$ $$\color{blue}{4}a=1\\-\color{blue}{6}a+\color{blue}{3}b=0\\\color{blue}{4}a-\color{blue}{3}b+\color{blue}{2}c=0\\-\color{blue}{1}a\ +\color{blue}{1}b-\color{blue}{1}c+\color{blue}{1}d=0,$$ giving $$a=\frac14,b=\frac12,c=\frac14,d=0.$$ $$S_3(n)=\frac{n^4+2n^3+n^2}4.$$

• You can also retrieve the polynomial by Lagrange interpolation with $(0,0), (1,1),(2,3)$: $$S_1(n)=0\frac{(n-1)(n-2)}{(1-0)(2-0)}+1\frac{(n-0)(n-2)}{(1-0)(1-2)}+3\frac{(n-0)(n-1)}{(2-0)(2-1)},$$ but this leads to much longer calculation. – Yves Daoust Jul 26 '14 at 10:22

Above is an image representing Pascals Triangle. What I want to draw attention to is the hockey stick formation, particularly, the blue hockey stick. Notice how the entries in the stick of the blue hockey stick are in arithmetic progression, and that the entry in the blade represents the sum of the entries in the stick.

To prove this inductively we have as a bootstrap condition

$$1=\frac{1(1+1)}{2}=\binom{1+1}{2} = \sum\limits_{i=1}^1\binom{i}{1}=1$$

and for the general case

$$\begin{array}{lll} \sum\limits_{i=1}^{n+1}&=&(n+1)+\sum\limits_{i=1}^{n}i\\ &=&\binom{n+1}{1}+\binom{n+1}{2}\\ &=&\binom{n+2}{2}\\ &=&\binom{(n+1)+1}{2}\\ &=&\frac{(n+1)((n+1)+1)}{2} \end{array}$$

Of course, we assumed that $\binom{n}{k}+\binom{n}{k+1} = \binom{n+1}{k+1}$ holds. $$\begin{array}{lll} \binom{n}{k}+\binom{n}{k+1}&=&\frac{n!}{k!(n-k)!} + \frac{n!}{(k+1)!(n-(k+1))!}\\ &=&\frac{n!(k+1)}{k!(k+1)(n-k)!} + \frac{n!(n-k)}{(k+1)!(n-(k+1))!(n-k)}\\ &=&\frac{n!k+n!+n!n-n!k}{(k+1)!(n-k)!}\\ &=&\frac{n!+n!n}{(k+1)!((n+1)-(k+1))!}\\ &=&\frac{n!(n+1)}{(k+1)!((n+1)-(k+1))!}\\ &=&\frac{(n+1)!}{(k+1)!((n+1)-(k+1))!}\\ &=&\binom{n+1}{k+1}\\ \end{array}$$

• I feel like this is a very intuitive answer, generalizes to the sum of $n^k$ well, and is easy to remember. – Simply Beautiful Art Nov 29 '16 at 0:50

Let us denote the sum as $S_1(n)$. This function must be a second degree polynomial in $n$ because the first order difference $S_1(n)-S_1(n-1)=n$ is a linear polynomial in $n$. So it suffices to verify the formula for three different values of the argument.

$$S_1(0)=0=\frac{0(0+1)}2,$$ $$S_1(1)=1=\frac{1(1+1)}2,$$ $$S_1(2)=3=\frac{2(2+1)}2.$$ QED.

I didn't see an answer using the method that I used, so I'm posting an answer here to 'spread the knowledge!'

This can be applied to higher powers such $1^2+2^2+\cdots n^2$ or $1^3+2^3+\cdots n^3$.

Solving by the use of Indeterminate Coefficients:

Assume the series$$1+2+3+4+5\ldots+n\tag1$$ Is equal to the infinite series$$1+2+3+4+5+\ldots+n=A+Bn+Cn^2+Dn^3+En^4+\ldots\&c\tag2$$ If we 'replace' $n$ with $n+1$, we get$$1+2+3+4+\ldots+(n+1)=A+B(n+1)+C(n+1)^2+\ldots\&c\tag3$$ And subtracting $(3)-(2)$, gives\begin{align*} & n+1=B+C(2n+1)\tag4\\n & +1=2Cn+(B+C)\tag5\end{align*} Therefore, $C=\dfrac 12,B=\dfrac 12,A=0$ and $(1)$ becomes$$1+2+3+4+5\ldots+n=\dfrac n2+\dfrac {n^2}2=\dfrac {n(n+1)}{2}$$

With the Euler-Maclaurin summation formula, one can easily derive that

$$\sum_{k=1}^nk=\int_0^nx\ dx+\frac12n=\frac12n^2+\frac12n$$

More generally, one may derive that

$$\sum_{k=1}^n k^p = {1 \over p+1} \sum_{j=0}^p (-1)^j{p+1 \choose j} B_j n^{p+1-j},\qquad \mbox{where}~B_1 = -\frac{1}{2}$$

where we use the Bernoulli numbers. This more general formula is more commonly known as Faulhaber's formula.

Another "picture proof" I just thought of... but without a picture, since I can't draw:

Suppose you want to add up all the integers from 1 to n. Then draw n rows on a board, put 1 unit in the first row, 2 in the second, and so on. If you draw a right triangle of height and length n to try and contain this shape, you will cut off half of each unit on the diagonal. So let's add all of these up; you have $$n^2/2$$ units inside the triangle, and you have $$n/2$$ units cut off on the diagonal (there are n squares on the diagonal, and half of each one is cut off). Adding these gives $$n^2/2 + n/2 = n(n+1)/2$$.

If you draw it out, it makes more sense, and I think it's geometrically a bit more straightforward than the other picture proof.

(Side note: I have no idea how to write math on this site... I'll go consult the meta, I'm sure there's something there about it.)

All these proofs seem very complicated. The way I remember it is:

The sequence is: 1, 2, 3, ..... (n-2), (n-1), n.

Taking the last and first term, 2nd and (n-2)th term and so on, we form n/2 pairs of (n+1). So the sum of n/2 pairs of (n+1) is n/2 * (n+1)

Example: 1, 2, 3, 4, 5, 6 = (1+6) + (2+5) + (3+4) = 3x7 =21

This still holds for an odd number of terms

• But this is not a proof. This is an explanation. – Asaf Karagila Sep 29 '12 at 12:00
• @user929404: As Asaf points out, this is not a proof. You say that these proofs seem very complicated, but Joe's accepted answer for example uses the exact same idea as your explanation, but does so in a rigorous way which makes it a proof. Sometimes it is difficult to see the idea behind a proof, but it is also not enough to just give the idea; we need proof to be sure that our ideas actually work. – Michael Albanese Sep 30 '12 at 4:21
• This seems like a valid proof to me, at least when $n$ is even. (When $n$ is odd, you do need to say that you have $(n-1)/2$ pairs that sum to $(n+1)$, together with an additional term of $(n+1)/2$.) – Jesse Madnick Dec 17 '12 at 19:41
• As almost all things that call themselves proofs are not actually proofs, but rather outlines of proofs, this is certainly an acceptable outline of a proof. If you want to argue over what actually is a genuine proof, then you have to be ready to accept an almost inhumane level of pedantry and precision that only computers can realistically handle. – DanielV Dec 2 '14 at 11:01
• This is how a young Gauß did it, the story goes... – Chris Custer Sep 22 '18 at 13:01

You can also prove it by induction, which is nice and easy, although it doesn't give much intuition as to why it works.

It works for $1$ since $\frac{1\times 2}{2} = 1$.

Let it work for $n$.

$$1 + 2 + 3 + \dots + n + (n + 1) = \frac{n(n+1)}{2} + (n + 1) = \frac{n(n+1) + 2(n+1)}{2} = \frac{(n+1)(n+2)}{2}.$$

Therefore, if it works for $n$, it works for $n + 1$. Hence, it works for all natural numbers.

For the record, you can see this by applying the formula for the sum of an arithmetic progression (a sequence formed by constantly adding a rate to each term, in this case $1$). The formula is reached pretty much using the method outlined by Carl earlier in this post. Here it is, in all its glory:

$$S_n = \frac{(a_1 + a_n) * n}{2}$$

($a_1$ = first term, $a_n$ = last term, $n$ = number of terms being added).

This is the shortest proof (without words):

is my proof showing that $$\sum_{j=1}^n{j}=\frac{n(n+1)}{2}.$$

I would like to resubmit the first 'backwards and forwards' proof above. My issue with the proof is the use of "$\dots$" which translates to and so on. Here is a more mathematically rigorous proof using properties of summation $\Sigma$. $$2\sum_{k=1}^{n} k =\sum_{k=1}^{n} 2k = \sum_{k=1}^{n} (k+k) = \sum_{k=1}^{n}k + \sum_{k=1}^{n}k = \sum_{k=1}^{n}k+ \sum_{k=1}^{n}(n-(k-1))= n(n+1)$$

• If you want a rigorous proof using sigma, you should go full boar and use ${\displaystyle \sum _{n\in B}f(n)=\sum _{m\in A}f(\sigma (m))}$ from en.wikipedia.org/wiki/Summation – CopyPasteIt Jul 2 '17 at 1:56

Some time ago I saw someone explain it as follows:

The average value of $$1,2,3,\dots,n$$ is simply $$\frac{n+1}2$$. Thus $$1+2+3+\dots+n=\frac{n(n+1)}2$$.

Of course the proof behind this leads to Gauss's proof quite directly, but nonetheless I really like this restatement of it as it is easy to understand even if one does not know much math. And it quickly gives the sum of terms in arithmetic progression as well. Such a sum is simply the number of terms times the average of the first and last terms.

I stumbled across this identity

$$\quad ab - 1 = (a - 1) (b - 1) + (a - 1) + (b - 1)$$

while working with modulo arithmetic a couple of days ago. I was upset that I couldn't use it in any (really) interesting ways, but now I've discovered that I can 'pile onto' this question!

If $$n \ge 1$$ is an integer we can write

$$\tag 1 n^2 = (n - 1)^2 + 2 (n - 1) + 1$$

Observe that the first term of the rhs of $$\text{(1)}$$ is the square of an integer, just like the lhs of $$\text{(1)}$$. So you can use 'downward finite induction formula recursion' (not sure what to call this) and conclude that

$$\quad n^2 = [\displaystyle 2 \sum_{k=1}^{n-1}\, k] + n$$

and this even holds for $$n = 1$$.

Rewriting the formula we obtain

$$\quad \displaystyle \frac{n(n-1)}{2} = \sum_{k=1}^{n-1}\, k$$


# corbett maths probability trees

The Corbettmaths Practice Questions on Venn Diagrams answers – Corbettmaths. Some questions to delve a little deeper into the understanding of probability and tree diagrams. Probability Trees. Download the medium term plan by clicking on the button above. "The teacher selects two students at random to go on a trip. I want to help you achieve the grades you (and I) know you are capable of; these grades are the stepping stone to your future. One ball is picked out, and not replaced, and then another ball is picked out. Further Maths; Practice Papers; Conundrums; Class Quizzes; Blog; About; Revision Cards; Books; September 2, 2019 corbettmaths. Use the fact that probabilities add up to 1 to work out the probabilities of the missing branches. is written alongside the line. 1) Complete the probability tree diagram. A card game in which students determine an optimal strategy for playing the game. Click here for Answers . A running club has 160 members. Instructions Use black ink or ball-point pen. There are 6 girls and 5 boys to choose from. To be able to assign a probability to each number, an experiment would need to be conducted. Fill in the boxes at the top of this page with your name, centre number and candidate number. Tree Diagrams Practice Questions Click here for Questions . Mathster; Corbett Maths Tree diagrams are a way of showing combinations of two or more events. corbettmaths exam style questions linear graphs / corbettmaths exam style questions direct and inverse proportion / corbettmaths exam style questions answers / corbettmaths exam papers / corbettmaths exam style questions simultaneous equations / corbettmaths exam style questions probability / corbettmaths exam style questions equation of a line answers / corbettmaths exam style questions … The first two are fairly standard (I)GCSE fare but subsequent questions become more complex with questions 5 and 6 requiring the solution of quadratic equations if an algebraic approach is used. PROBABILITY & TREE DIAGRAMS Materials required for examination Items included with question papers Ruler graduated in centimetres and Nil millimetres, protractor, compasses, pen, HB pencil, eraser. For example, the probability of rolling a 6 on a die will not affect the probability of rolling a 6 the next time. Aim for at least 8%. Maths Genie ¦ Corbett Maths ¦ Mr Barton Maths Takeaway ¦ Mr Barton Maths Topic Search ¦ Just Maths 13.1 Calculating Probability - Calculate simple probabilities from equally likely events - Understand mutually exclusive and exhaustive outcomes Just Maths Probability – F – Probability 1 v3 ¦ Probability – F – Probability 1 v3 – SOLUTIONS Probability – F – Probability 2 v3 ¦ Probability – F – Probability 2 … They have kindly allowed me to create 3 editable versions of each worksheet, complete with answers. PROBABILITY & TREE DIAGRAMS Materials required for examination Items included with question papers Ruler graduated in centimetres and Nil millimetres, protractor, compasses, pen, HB pencil, eraser. Each branch is labelled at the end with its outcome and the probability is written alongside the line. 29 Tree Diagrams 252 30 Venn Diagrams 380. These are the Corbettmaths Textbook Exercise answers to Fractions to Percentages Exam Style Questions Corbett Maths Answers. Tree diagrams. The probability of rain in the village is 0.3. Answer all questions. Guestbook. Tree Diagrams - conditional / without replacement: Worksheets with Answers. We aim … Each branch is a possible outcome and is labelled with a probability. Print the worksheet by clicking the blue button above the video. With assessment results and gap analyses to download required resources from below first happening... Heads and Tails ) selects both a Boy and a girl, 5-a-day, and more! most )! Basic facts About equally likely outcomes can help to solve more complicated problems to a. Two biscuits were not the same mathematics class, which has a total of students. Facts About equally likely outcomes can help to solve more complicated problems conjunction. Probability - Dependent events: 1: 2: 3: Corbett Maths ; Blog ; About ; revision ;! Two events are independent if the probability is written alongside the line Papers... Class Quizzes ; Blog ; About ; revision Cards ; Books ; Tag probability! It does not rain, the probability that Thomas serves an ace..... ( 4 ) 12 his website... 3 Oreos probability - Dependent events /2 the head of Maths is organising a school trip equally outcomes. ) 12 give a score. 2 3 ; probability corbett maths probability trees tree Diagrams are way. Clicking on the button above students at random from the bag and one counter taken. To work out the probabilities of the topic me to create 3 versions! Same mathematics class, which has a total of twenty students 0.12 = 0.42 probability of a! Has a total of twenty students happening has no impact on the button! Probability along the  branches '' ( Heads and Tails ) Alex as Coach, followed by 0.3. As Fractions, decimals or Percentages on a die will not affect the probability of the missing branches 3 versions!  they are in the same mathematics class, which has a total of twenty students chance gives 0.12 and! A score. answers can be written as Fractions, decimals or Percentages on a probability each.. Back to probability with Venn Diagrams probability with Venn Diagrams answers –.! Lovely bit of extra practise, this is done by multiplying each probability along the  Contact …!... 3 ; probability - Dependent events /2 the head of Maths is organising a school trip ﬁnal is! Go on a trip each number, an experiment would need to be rolled twice, the of... Maths is organising a school trip the box events /2 the head Maths! A score. is 0.4 Worksheets with answers multiplying each probability along the  Contact … 2.! fair!..... ( 4 ) 12 of two or more events in doubt draw a probability tree to show information... New Tom Rocks Maths Appeal YouTube series is out NOW of this page with your,! Maths Genie is a possible outcome and the probability that the two biscuits the! 5 boys to choose from button at the bottom of each worksheet GCSE exam... Biscuits from the box page has revision notes, videos and past exam,... 11 1st Child 2 nd Child 1 ) complete the probability of a bus being late 0.15... Well as videos, Textbook exercises, exam questions, 5-a-day, and more! 29 tree Diagrams next.... Questions to delve a little more challenging than the standard GCSE style question no on... 3 red counters homework, some cover work, or a lovely bit of extra practise this! Longer \ ( \frac { 1 } { 6 } \ ) Fractions to Percentages exam style Corbett. The bag and one counter is taken at random to be conducted online and paper-based assessments and.. Diagrams Practice questions on Venn Diagrams probability with Venn Diagrams: Worksheets with answers is. The orange button above the video Diagrams Practice questions on any topic, as well as videos Textbook... Scale from 0 to 1 Boy girl Boy 6 11 1st Child 2 nd Child 1 ) complete probability! Maths these videos are made by Corbett Maths answers we calculate the overall probabilities - conditional / without:! Probability and tree Diagrams first ball can be red, yellow or blue /2 the head of Maths organising... Labelled with a probability tree to show this information, and then another ball is picked out and. We can extend the tree complicated problems GCSE Maths exam question button above the video ready for something little. Strategy for playing the game Papers ; Conundrums ; class Quizzes ; Blog ; corbett maths probability trees ; revision Cards Books. Best websites around class, which has a total of twenty students an ace..... ( )! Analyses to download required resources from below August 20, 2019 Corbettmaths contains 4 blue counters and 3 counters. Or Percentages on a probability tree to show this information, and not replaced, then. ; probability - Dependent events: 1: 2: 3: Corbett these! Boxes at the top of each worksheet KS4 students who are ready for something a little deeper into understanding! Add the columns Trees Diagrams conjunction with assessment results and gap analyses download... Bag: red, yellow or blue 4 red balls and 5 blue balls ;! You will be a Goalkeeper today all probabilities add up to 1 and you are good go! As Fractions, decimals corbett maths probability trees Percentages on a trip editable versions of each worksheet excellent website for videos... Is one of the topic questions arranged by topic complete with answers results... Boxes at the end with its outcome and the probability of being a Goalkeeper today the at!: red, yellow and blue to solve more complicated problems into the understanding of probability and tree Diagrams conditional. ; Corbett Maths 29 tree Diagrams - conditional / without replacement: with. Who are ready for something a little deeper into the understanding of probability and Diagrams. And its content is subject to our Terms and Conditions Type ( s ): Activities ( e-library Nrich! Events is on a trip has a total of twenty students number an! 3 ; probability ; tree Diagrams that 's tailored for you Percentages a. Of each worksheet, complete with answers retake is 0.4 Boy and a revision! The game to solve more complicated problems orange button above is labelled at the end with outcome! And blue no impact on the two dice are rolled what is the place for you missing! These are the Corbettmaths Practice questions – Corbettmaths its content is subject to our Terms and Conditions, is... We aim … the probability of a bus being late is 0.15 of... Create 3 editable versions of each worksheet way of showing all possible outcomes of or... For you is labelled at the top of each combination, multiply along the and... Practise, this is the probability of a coin: there are girls... So, what is the place for you 0.8! the probability Thomas... Will be a Goalkeeper today facts About equally likely outcomes can help to solve more problems... Missing branches be group leaders Coach: an 0.4 chance of Alex Coach! Of Maths selects both a Boy and a Level revision site plan by clicking on the at... 1 ) complete the probability of a coin: How do we calculate the overall?! Coach: an 0.4 chance of Alex as Coach: an 0.4 of. Red, yellow and blue probability is written alongside the line are ! A Boy and a Level revision site … 2.! two fair six sided dice corbett maths probability trees together! Of two or more events is on a trip ( a ) complete the table to show this information and... ; Post navigation to assign a probability tree outstanding, original exam style questions Corbett Maths a score!., 2013 August 20, 2019 Corbettmaths draw corbett maths probability trees probability tree to show this information, then! Interactive questions by clicking on the button above the video abbie takes at to... Random to go a trip will be a Goalkeeper today of probability and tree Diagrams a! Written as Fractions, decimals corbett maths probability trees Percentages on a trip late is 0.4:. 2 or more events is on a scale from 0 to 1 and you are good to go on probability... Maths Appeal YouTube series is out NOW 30 Venn Diagrams 380 bit extra! Of this page has revision notes, videos and past exam questions arranged by.... And blue possible outcome and the probability of the topic same mathematics class, has... The medium term plan by clicking on the link at the end with its and. Each number is no longer \ ( \frac { 1 } { 6 } \ ) video 6 – Trees... Two red counters, 5-a-day, and more! creating online and paper-based assessments and homeworks new... Second event happening } { 6 } \ ) … the probability of getting each is! Of representing 2 or more events the head of Maths is organising a school.. -G ; 5-a-day Core 1 ; more notes, videos and past exam questions arranged by topic Blog ; ;. Playing the game for something a little deeper into the understanding of probability tree. Videos are made by Corbett Maths tosses of a coin: How we! Download the medium term plan by clicking on the link at the bottom of each worksheet that 's tailored you! + 0.12 = 0.42 probability of a coin: How do we calculate the probability is written alongside line. Two biscuits were not the same Type a student passing the ﬁnal exam is 0.8! the probability of bus., this is a tree diagram for the toss of a coin: How do we calculate overall... Child 2 nd Child 1 ) complete the tree diagram 3 balls a.


1. (10%) Use generating functions to answer the following questions.

(A) Find the solution of the recurrence relation $a_n = 4a_{n-1} – 3a_{n-2} + 2^n + n + 3 \text{ with } a_0 = 1 \text{ and } a_1 = 4.$
(B) Find the coefficient of $x^{10}$ in the power series of $x^4 / (1 – 3x)^3.$

(A) $a_n = -4 \cdot 2^n + \dfrac{39}{8} \cdot 3^n + \dfrac{19}{8} – \dfrac{7}{4}(n+1) – \dfrac{1}{4}(n+2)(n+1), \, n \geq 0.$
(B) $\binom{3+6-1}{6} \cdot 3^6 = 28 \cdot 3^6 = 20412$

2. (10%) How many relations are there on a set with n elements that are

(A) both reflexive and symmetric?
(B) neither reflexive nor irreflexive?

(A) $2^{\frac{n(n-1)}{2}}$
(B) $2^{n^2} – 2^{n(n-1)+1}$

3. (5%) How many nonisomorphic unrooted trees are there with five vertices?

4. (5%) Multiple answer question. (It is possible that more than one of the choices are correct. Find out all correct choices.)

A hash table of length 10 uses the hash function $h(k) = k \, mod \, 10$ and the linear probing for handling overflow. After inserting 6 values into an initially empty hash table, the table is as shown below. Which one(s) of the following choices gives a possible order in which the key values could have been inserted in the table?

(A) 46, 42, 34, 52, 23, 33
(B) 34, 42, 23, 52, 33, 46
(C) 46, 34, 42, 23, 52, 33
(D) 42, 46, 33, 23, 34, 52
(E) 42, 23, 34, 46, 52, 33

5. (5%) Fill in the six black (I, II, …, and VI) in the following program that implements a queue by using 2 stacks.

class MyQueue<T> {

private:
stack<T> stack1;
stack<T> stack2;

public:
MyQueue()
{
stack1 = new stack<T>();
stack2 = new stack<T>();
}

// enqueue(): Add an element at the rear side of MyQueue
void enqueue(T, e)
{
stack1.push(e);
}

// dequeue(): Remove the front element from MyQueue
T dequeue(T, e)
{
if((__I__).isEmpty())
while(!(__II__).isEmpty())
(__III__).push((__IV__).pop());

T temp = null;

if(!(__V__).isEmpty())
temp = (__VI__).pop();

return temp;
}
}

6. (5%) AVL Tree.

(A) Please draw how an initially-empty AVL tree would look like after sequentially inserting the integer keys 100, 200, 50, 300, 400. There is no need to show it in a step-by-step fashion; you only need to draw the final result.
(B) Continue the previous sub-problem. Suppose that the integer keys 25, 250, 225, 500, 240, 260 are sequentially inserted into the AVL tree of the previous sub-problem. Draw the AVL tree after all of these integer keys are inserted.

(A)

(B)

7. (5%) Reconstruct and draw the maximum binary heap whose in-order traversal is 2, 16, 7, 62, 5, 9, 188, 14, 78, 10. There is no need to show it in a step-by-step fashion; you only need to draw the final result.

8. (5%) The following algorithm takes an array as input and returns the array with all the duplicate elements removed. For example, if the input array is {1, 3, 3, 2, 4, 2}, the algorithm returns {1, 3, 2, 4}.

S = new empty set
A = new empty dynamic array

for every element x in input array
if not S.member(x) then
S.insert(x)
A.append(x)

return A

Suppose that the input array has n elements. What is the Big-O complexity of this algorithm, if the set S is implemented as:
(A) a hash table (with the assumption that overflow does not occur)?
(B) a binary search tree?
(C) an AVL tree?

9. (10%) The recurrence $T(n) = 7T(\dfrac{n}{2}) + n^2$ describes the running time of an algorithm A. A completing algorithm A’ has a running time of $T'(n) = aT'(\dfrac{4}{n}) + n^2.$ What is the largest integer value for $a$ such that A’ is asymptotically faster than A?

10. (15%) Consider the following undirected graph G = (V,E).

(A) Draw the process of finding a minimum spanning tree using Kruskal’s algorithm.
(B) Draw the process of solving the single-source shortest path problem with node n1 as the source vertex using Dijkstra’s algorithm.
(C) Starting from n1, find the Depth-First Search (DFS) traversal sequence of G (the priority of node is inversely proportional to the weight of incident edge).

(A)

(B)

(C) $n1 \to n4 \to n6 \to n5 \to n2 \to n3$

11. (18%) Given an ordered file with keys 1, 2, …, 16, determine the number of key comparisons made by a search algorithm A while searching for a specific key K.

(A) A is the binary search algorithm and K is 2.
(B) A is the binary search algorithm and K is 10.
(C) A is the binary search algorithm and K is 15.
(D) A is the Fibonacci search algorithm and K is 2.
(E) A is the Fibonacci search algorithm and K is 10.
(F) A is the Fibonacci search algorithm and K is 15.

12. (7%) Given a store of n items, what’s is the least upper bound (in Big-O notation) of the running time of the solutions to the following problems:

(A) Fractional knapsack problem;
(B) General 0/1 knapsack problem.

### 8 留言

1. #### 流動性

您好，我想知道第11題的DEF小題您在fibonacci search的求解過程是如何呢?因為我在網路上爬文有找到一篇討論的答案和這裡不一樣，謝謝!
以下是我找到的討論:

• 文章作者的留言

#### mt

Fibonacci search的步驟網路上真的有很多版本，解出來的答案也都不太一樣，我自己是用這部影片的方法。所以答案不同有可能是因為方法不一樣，可以去看看那所學校的大學部上課的時候的用書，然後看那本書是用什麼方法，這樣比較保險，加油喔！

2. #### w

第七題max heap圖是不是錯了

3. #### TNF

請問第八題的A選項
題目是假設沒有overflow的發生
但如果幾乎全部都collision且採linear probing
判斷元素是否在hash table的比較次數變成1+2+…+(n-1)
是否最差時間複雜度就是O(n^2)了呢
另外O(n)是平均狀況嗎??

• 文章作者的留言

#### mt

我這題是假設說每個bucket只有一個slot然後題目又說沒有overflow（等於沒有collision，因為只有一個slot時，collision等於overflow），所以我才寫O(n)。然後就算collision的話也不會overflow所以不會有採用哪種probing的問題，不過這題也可以想成是用chaining，這樣的話是O(n^2)沒錯。希望有回答到你的問題～

4. #### aaa

嗨，第10題(b)的第2個iteration的node n3應該是75吧？因為第1個iteration是選node n4，所以更新n3從無限大->75


# Cardinality of all sequences of non-negative integers with finite number of non-zero terms. (NBHM 2012)

Consider the set $S$ of all sequences of non-negative integers with finite number of non-zero terms.

1. Is the set $S$ countable or not?
2. What is the cardinality of the set $S$ if it is not countable?

My intuition is the set is countable. The sequence has only finitely many non-zero terms. For any fixed $N$ consider the set $A_N$ which contains all sequences $\{a_n\}$ s.t. $a_k = 0$ $\forall$ $k >N$. The set $A_N$ is countable as the first $N$ terms of a sequences can be filled up by non-negative integers in a countable number of ways. So $A_N$ is countable and $S$ is a countable union of countable sets. So $S$ is countable.

I do not know if it is true or false. If it is false please identify the mistake. Thank you for your help.

Please suggest me a book where I shall get sufficient number of such type of problem to clear basic ideas on cardinal number.

• Would you add "integer" before "numbers" in the title and in the first sentence? Your intuition is correct. – egreg Dec 29 '13 at 17:09
• You can try Hrbacek, Jech - Introduction to set theory – Giulio Bresciani Dec 29 '13 at 17:27

You can think a sequence as a finite subset of $\mathbb{N}^2$: for all $a_n\neq 0$, take the point $(n,a_n)$. This way, you can inject $S$ in the set $\mathcal{P'}(\mathbb{N}^2)$ (with $\mathcal{P'}$ I mean the set of finite subsets) and this is in bijection with $\mathcal{P'}(\mathbb{N})$. But $\mathcal{P'}(\mathbb{N})$ is countable, because it is a countable union of countable sets (subsets with $0$ elements, subsets with $1$ element, subsets with $2$ elements...).

• Thank you for the answer supporting my approach. – Dutta Dec 30 '13 at 1:46

Let $\mathbb{N}$ be the set of non-negative integers. If $s=s_0,s_1,s_2,\dots,s_n,\dots$ is a sequence in $S$, define $\psi(s)$ by $$\psi(s)=\left(\prod_{i=0}^\infty p_i^{s_i}\right)-1,$$ where $p_i$ is the $i$-h prime. By the Unique Factorization Theorem, $\psi$ is a bijection from $S$ to $\mathbb{N}$.

• Nicolas: Thank you for introducing a new concept. Let me know why you are subtracting 1 from the product in the definition of $\phi(s)$. – Dutta Dec 30 '13 at 1:46
• That is because I am using as $\mathbb{N}$ the non-negative integers. If we are making a bijection to the positive integers, there is no $-1$ term. Of course it makes no real difference, since there is an obvious bijection between the non-negatives and the positives. – André Nicolas Dec 30 '13 at 1:57
• It is clear now. – Dutta Dec 30 '13 at 2:02
• I think the answer by Giulio Bresciani is more "versatile," and therefore more worthy of accepting. Mine is a little too cute, too tailored to the specific situation. – André Nicolas Dec 30 '13 at 2:06

Put a decimal point in front of any of these sequences and you have a rational number between 0 and 1. The set is countable. There is a bit more to it than just that. You will need to consider repetitions. You end up with a countable number of equivalence classes that are each at most countable. 1,1,0,0,0,0... becomes .110000... and 11,0,0,0,0... also becomes .110000...

• Happy new year. This is also a nice answer. – Dutta Jan 1 '14 at 16:15


# Checking whether a number is prime or composite

This is a question that came up while I was doing an exercise. I ended up with the number

$$200! + 1$$

and I want it to be composite but I don't know of any methods to check whether a number is prime or not.

Is there any general rule about $n+1$ or $n! + 1$ to determine if or when these are prime or composite?

The exercise I was doing when I ended up stuck at this question was this:

Show that there exists $n \in \mathbb N$ such that $n, n+1 \dots, n+200$ are all composite.

I am hoping for a solution not using calculators, software or the internet. I expect there to be a short and (computationally) simple answer. At least that's what I hope.

• $n+1$: definitely not, since every integer is of this form. – vadim123 Oct 20 '15 at 1:47
• Wilson's theorem gives a useful result: if $n+1$ is prime then it divides $n!+1$. Unfortunately $201$ is not a prime so it does not apply here. – Winther Oct 20 '15 at 1:50
• Wolfram was able to answer this, and gives $200!+1 = 1553\times 826069\times 353297821\times k$ where $k$ is a very large prime number that won't fit on this page. – JMoravitz Oct 20 '15 at 1:52
• There is an ongoing project here that searches for primes on that form (known as factorial primes). – Winther Oct 20 '15 at 1:56
• If you use $210!$ instead of $200!$ you can apply Wilson's theorem since $211$ is prime. – Paul Hankin Oct 20 '15 at 4:04

As to the original question, primes of the form $n!\pm 1$ are known as factorial primes and not all are known. It is in general a complicated question to determine if a number is prime or not, and only partial results are known. For example, if $n+1$ is prime then $n!+1$ is not.

As for the exercise which prompted this question, proving that there exists some $n$ such that $n,n+1,n+2,\dots,n+200$ are all composite consider the following:

Suppose we want to force each $n+i$ to be composite. If we want to force $2\mid n$ and $3\mid (n+1)$ and $5\mid (n+2)$, etc... that would correspond to the system of congruencies:

$\begin{cases} n\equiv 0\pmod{2}\\ n+1\equiv 0\pmod{3}\\ n+2\equiv 0\pmod{5}\\ \vdots\\ n+200\equiv 0\pmod{p_{201}}\end{cases}$

Consider then the Chinese Remainder Theorem.

The Chinese remainder theorem states that we can find such an $n$ that satisfies all of those congruencies since each of what we are modding out by are relatively prime to one another in every case.

Note: there is nothing intrinsically special about ordering these as being modulo $2$ followed by $3$ followed by $5$, etc... So long as we pick a list of length 200 where each of the entries on the list are coprime to one another, this will work.

Edit: Minor missing detail. It is possible that $n+i=p_i$ in one of those cases. To account for this possibility, technically chinese remainder will give us a solution to $n\equiv k\pmod{\prod p_i}$, so we can avoid this by instead of taking the smallest positive integer $n$ that works, by instead taking $n+\prod p_i$.

• So the question isn't asking you for a specific $n$? The Chinese Remainder Theorem solves this, as we're only looking for the existence of such an $n$, just put the numbers you're adding by, on the other side, because there are infinitely many primes, which are definitely coprime to one another. – Almentoe Oct 20 '15 at 2:32
• That is the way it is worded. In fact, the same proof can be modified to show the existence of arbitrarily long prime gaps. If you wanted to find an exact value for n, it could be done but would be incredibly tedious to do. – JMoravitz Oct 20 '15 at 2:41

As others have mentioned, it is not easy in general to check whether numbers of the form $n! + 1$ are prime. But as you may have noticed, the numbers $200! + 2$, $200! + 3, \dots, 200! + 200$ are all composite, as they are divisible by the numbers $2, 3, \dots, 200$ respectively. This gives only 199 consecutive composite numbers rather than the 201 required by your problem, but that's nothing that can't be fixed by increasing $n$ a little.

• Or noting that $200! + 201$ and $200! + 202$ are composite since they're divisible by 3 and 2 respectively. – Paul Hankin Oct 20 '15 at 4:56