# Can you write a Geometric random variable as some combination of Bernoulli random variables?

Background

Given $$Y \sim \text{Binomial(n,p)}$$, we can write $$Y = \sum_{i=1}^{n} X_i$$ where $$X_1,X_2,...,X_n$$ are iid $$\text{Bernoulli}(p)$$. This is useful in, for example, determining the mean of a binomial random variable: $$E(Y)=E\left(\sum X_i\right) = \sum E(X_i) = np$$

Question

If we are given $$Y \sim \text{Geometric(p)}$$, can we similarly write $$Y$$ as some combination of Bernoulli random variables?

• It would have to be an infinite combination, wouldn't it? By "combination" do you mean a sum of independent variables or would you include more general operations? If so, what would they be?
– whuber
Dec 7 '20 at 20:14
• I was trying to think about how to do it with a sum, but I couldn't make it work. So I decided to put "combination" instead. Yes, I would include more general operations. I'm not sure what they would be... I was thinking we need some way to mathematically "keep track" of whether we have gotten a success, because once we get a success, we stop the Bernoulli trials. But I'm not sure what that would look like. I think if we did have some kind of infinite sequence of operations and the "keep track" operation automatically becomes 0 once we get a success, it might work? Dec 7 '20 at 20:19
• Trivially, every discrete distribution is a mixture of (shifted or scaled) Bernoulli distributions. A less trivial result is that the geometric distribution cannot be expressed as the sum of independent Bernoulli distributions, as you have already figured out.
– whuber
Dec 7 '20 at 20:25

For clarity, I am going to look at the version of the geometric distribution with support on the non-negative integers, with expected value $$\mathbb{E}(Y) = (1-p)/p$$. Now, suppose we have a sequence of Bernoulli random variables $$X_1,X_2,X_3,... \sim \text{IID Bern}(p)$$ to use for the construction.

The geometric random variable $$Y$$ can be interpreted as the number of "failures" that occur before the first "success", so it can be written as:

\begin{align} Y &\equiv \max \ \{ y = 0,1,2,... | X_1 = \cdots = X_{y} = 0 \} \\[12pt] &= \max \Bigg\{ y = 0,1,2,... \Bigg| \prod_{\ell = 1}^{y} (1-X_\ell) = 1 \Bigg\} \\[6pt] &= \sum_{i=1}^\infty \prod_{\ell = 1}^{i} (1-X_\ell). \\[6pt] \end{align}

This is probably the "simplest" you can write the expression, since it accords with the descriptive intuition of what the random variable represents. As whuber notes in the comments, every discrete distribution can be written as a mixture of a countable number of shifted or scaled Bernoulli random variables (and indeed, there are an infinite number of ways to do this).

(Note: For the other version of the geometric distribution, with support on the positive integers, the random variable can be interpreted as the number of trials that occur by the time of the first "success", which is one more than the number of "failures". In this case you just add one to the above expression to get construct the random variable.)

Confirming the result: To see that this expression is adequate, note that:

\begin{align} F_Y(y) \equiv \mathbb{P}(Y \leqslant y) &= 1 - \mathbb{P}(Y \geqslant y+1) \\[12pt] &= 1 - \mathbb{P} \Bigg( \prod_{\ell = 1}^{y+1} (1-X_\ell) = 1 \Bigg) \\[6pt] &= 1 - \prod_{\ell = 1}^{y+1} \mathbb{P}(1-X_\ell = 1) \\[6pt] &= 1 - \prod_{\ell = 1}^{y+1} \mathbb{P}(X_\ell = 0) \\[6pt] &= 1 - \prod_{\ell = 1}^{y+1} (1-p) \\[6pt] &= 1 - (1-p)^{y+1}, \\[6pt] \end{align}

which is the CDF of the (chosen version of the) geometric distribution.

• This is cool! It looks like we can compute $E(Y)$ using your result, although I'm not sure about one step. $$E(Y) = E\left(\sum_{i=0}^{\infty} \prod_{l=0}^{i} (1-X_i)\right)=\sum_{i=0}^{\infty} \prod_{l=0}^{i}E(1-X_i)=\sum_{i=0}^{\infty}(1-p)^i=\frac{1-p}{p}$$ We can move the expectation inside the product because of independence. The only thing I'm not sure about is moving the expectation inside an infinite sum. I think it's justified because (with probability 1) the tail terms of the sum are 0. Dec 7 '20 at 22:56
• You can move an expectation inside the infinite sum via the linearity property. You can then move it inside the product via independence. There are some errors in your working (e.g., wrong subscripts, etc). It should be: $$\mathbb{E}(Y) = \mathbb{E} \Bigg( \sum_{i=1}^\infty \prod_{\ell = 1}^{i} (1-X_\ell) \Bigg) = \sum_{i=1}^\infty \prod_{\ell = 1}^{i} \mathbb{E} (1-X_\ell) = \sum_{i=1}^\infty (1-p)^i = \frac{1-p}{1-(1-p)} = \frac{1-p}{p}.$$
– Ben
Dec 7 '20 at 23:01
• Yes, I see that now. Thanks! Dec 7 '20 at 23:06


# Optimization - rectangle inscribed in a right triangle

1. Dec 18, 2013

### ghostanime2001

1. The problem statement, all variables and given/known data
A rectangle is to be inscribed in a right triangle having sides 3 cm, 4 cm and 5 cm, as shown on the diagram. Find the dimensions of the rectangle with greatest possible area.

2. Relevant equations
1. $x^{2}+y^{2}=w^{2}$ in terms of $w=\sqrt{x^{2}+y^{2}}$

2. $\dfrac{x}{3}=\dfrac{y}{4}$

3. $\dfrac{l}{3}=\dfrac{4-y}{5}$

4. $\dfrac{l}{x}=\dfrac{4-y}{w}$

3. The attempt at a solution

Area of the rectangle is $A=lw$. But, we want an expression for area in terms of one variable.

rewriting equation 2 for $x$ we can get an expression in $y$

$4x=3y$

$x=\dfrac{3y}{4}$

which we can substitute in equation 1 to find width $w$ in terms of $y$

$w=\sqrt{x^{2}+y^{2}}$

$w=\sqrt{\left(\dfrac{3y}{4}\right)^{2}+y^{2}}$

$w=\sqrt{\dfrac{9}{16}y^{2}+y^{2}}$

$w=\sqrt{\dfrac{25}{16}y^{2}}$

$w=\dfrac{5}{4}y$

Using similar triangles of the upper right, smaller right triangle and the bigger, outer triangle we set a relationship between the base of smaller triangle and the base of the outer triangle, and, the hypotenuse of the smaller triangle and the hypotenuse of the outer triangle. We solve for the length of the rectangle in terms of $y$ using equation 3.

$\dfrac{l}{3}=\dfrac{4-y}{5}$

$5l=3\left(4-y\right)$

$l=\dfrac{3\left(4-y\right)}{5}$

We now have the length $l$ and width $w$ in terms of one variable $y$. We substitute the expressions in the area of the rectangle to find the area in one variable $y$

$A\left(y\right)=l\left(y\right)w\left(y\right)$

$A\left(y\right)=\dfrac{3\left(4-y\right)}{5}\dfrac{5}{4}y$

$A\left(y\right)=\dfrac{15y\left(4-y\right)}{20}$

$A\left(y\right)=\dfrac{3y\left(4-y\right)}{4}$

$A\left(y\right)=\dfrac{12y-3y^{2}}{4}$

$A\left(y\right)=3y-\dfrac{3}{4}y^{2}$

Differentiating this expression and setting $A'\left(y\right)=0$ gives $0=3-\dfrac{3}{2}y$

solving for $y$ gives

$\dfrac{3}{2}y=3$

$y=2$

substitute $y=2$ in the length $l=\dfrac{3\left(4-y\right)}{5}$ and width $w=\dfrac{5}{4}y$ equations respectively,

$l=\dfrac{3\left(4-\left(2\right)\right)}{5}=\dfrac{6}{5}$

$w=\dfrac{5}{4}\left(2\right)=\dfrac{5}{2}$

Therefore, the rectangle with dimensions $l=\dfrac{6}{5}=\text{1.2 cm}$ and $w=\dfrac{5}{2}=\text{2.5 cm}$ has the maximum possible area of $\text{3 }cm^{2}$

*above I used the more tedious way I guess...

My question is if I can do it using equation 4 since $l$ and $w$ are already there and cross multiplying would give me area automatically. I would have an expression in $x$ and $y$ but I can use equation 2 to find either $x$ or $y$ and set up the area in one variable. Would this way be the more correct method or give the same answer as above? Thanks !

#### Attached Files:

• ###### Untitled.png
File size:
64.2 KB
Views:
186
2. Dec 18, 2013

### scurty

That works! I get an answer of 3. Did you try it out and see how the answers compared? You can use the proportion $\frac{x}{3} = \frac{y}{4}$ to get the equation in terms of only x or y and then take the derivative, etc.

As for more "correct," every method that arrives at a solution is correct, but this way might be more elegant because it only takes 5 lines or so of equations.

3. Dec 18, 2013

### Ray Vickson

It is a lot easier to use
$$\frac{l}{4-y} = \frac{3}{5} \Longrightarrow l = (3/5)(4-y)\\ \frac{w}{y} = \frac{5}{4} \Longrightarrow w = (5/4)y$$
giving $A = l w = (3/4) y(4-y) = 3 y - (3/4)y^2.$

4. Dec 19, 2013

### ghostanime2001

Ray Vickson, I had overlooked this relation! Your relation directly solves $w$ in terms of $y$ avoiding going through using pythagorean theorum and equation 2. Am I right ? or am I right ?

The first relation is the same one I acquired. It is just written differently.

$\dfrac{w}{y}=\dfrac{5}{4}\Rightarrow w=\dfrac{5}{4}y$

scurty, I have used equation 4 and equation 2 to solve for area $lw$ in terms of $x$ (instead of $y$ as previously used) and I get

$A=lw=4x-\dfrac{4}{3}x^{2}$

compared to $A=lw=3y-\dfrac{3}{4}y^{2}$

5. Dec 19, 2013

### scurty

I can't tell if you are just acknowledging that the method worked (if so, good job!) or you are confused. Sorry, haha, could you just clear that up for me?

6. Dec 19, 2013

### ghostanime2001

the area equation in terms of $x$ is correct, no ? I just want to know if I did my algebra right. I substituted the value of $x=\dfrac{3}{2}=\text{1.5 cm}$ into the area equation and it comes out to $\text{3 }cm^{2}$. Do you have the same numbers & answer ?

7. Dec 19, 2013

### scurty

Yes, it's correct! There's more than one way to arrive at the solution.


# A sigma notation but with multiplication instead of addition?

I am not a mathematician, so I apologize if this question will sound stupid. I am wondering is there some sort of notation which will resemble the one of sigma notation, but with multiplication instead of addition?

For example, the following expression: $2^1+2^2+2^3+2^4+2^5$ could be written as: $\sum_{i = 1} ^ 5 2^i$

But what about the following expression: $2^1*2^2*2^3*2^4*2^5$ ?

Is there some notation like sum sigma that could enable me to write this last expression a bit shorter?

Thank you very much.

• $\prod$ $$\prod_{k=1}^5 2^k$$ – Daniel Fischer Aug 7 '14 at 22:19
• This may already be obvious to you, but I'll leave it here anyway: S is for sum, P is for product. Sigma and pi are the Greek letters for S and P. – Rahul Aug 7 '14 at 22:51
• Amusingly, you can do without a new notation, because $2^1\cdot2^2\cdot2^3\cdot2^4\cdot2^5$ is $$2^{1+2+3+4+5}=2^{\sum_{i=1}^5i}.$$ – Yves Daoust Aug 7 '14 at 23:02

You can use Pi notation (The $\LaTeX$ for this being \prod)
$$\prod\limits_{i = 1}^5 2^i = 2^1 \cdot 2^2 \cdot 2^3 \cdot 2^4 \cdot 2^5$$


# Thread: Red marbles, white marbles, in a bag.

1. ## Red marbles, white marbles, in a bag.

So,
I have a bag containing 10 blue marbles and 5 red marbles. If I draw 8 marbles without replacement, what is the probability of me getting 1 red marbles out of 8?
2 out 8; 3; 4;5?
How do you calculate that?

Additionally, how would you calculate the probability of my getting at least 1 red marbles out of 8? At least 2; 3; 4; 5?
And how do you calculate that?

Thanks

2. ## Re: Red marbles, white marbles, in a bag.

Hello, Sabre!'

Here's the first half of your question . . .

I have a bag containing 10 blue marbles and 5 red marbles.
If I draw 8 marbles without replacement, what is the probability of getting:

(a) 1 red marble and 7 blue marbles?
There are: . ${15\choose8} \,=\,6,\!435$ possible outcomes.

To get 1 red and 7 blue: . ${5\choose1}{10\choose7} \:=\:5\cdot 120 \:=\:600$ ways.

Therefore: . $P(\text{1 red}) \:=\:\frac{600}{6,\!435} \:=\:\frac{40}{429}$

(b) 2 red marbles and 6 blue marbles?
To get 2 red and 6 blue: . ${5\choose2}{10\choose6} \:=\:10\cdot210 \:=\:2,\!100$ ways.

Therefore: . $P(\text{2 red}) \:=\:\frac{2,\!100}{6,\!435} \:=\:\frac{140}{429}$

(c) 3 red marbles and 5 blue marbles?
To get 3 red and 5 blue: . ${5\choose3}{10\choose5} \:=\:10\cdot252 \:=\:2,\!520$ ways.

Therefore: . $P(\text{3 red}) \:=\:\frac{2,\!520}{6,\!435} \:=\:\frac{56}{143}$

(d) 4 red marbles and 4 blue marbles?
To get 4 red and 4 blue: . ${5\choose4}{10\choose4} \:=\:5\cdot210 \:=\:1,\!050$ ways.

Therefore: . $P(\text{4 red}) \:=\:\frac{1,\!050}{6,\!435} \:=\:\frac{70}{429}$

(e) 5 red marbles and 3 blue marbles?
To get 5 red and 3 blue: . ${5\choose5}{10\choose3} \:=\:1\cdot120 \:=\:120$ ways.

Therefore: . $P(\text{5 red}) \:=\:\frac{120}{6,\! 435} \:=\:\frac{8}{429}$

3. ## Re: Red marbles, white marbles, in a bag.

Thank you Soroban,

Questions
Originally Posted by Soroban
There are: . ${15\choose8} \,=\,6,\!435$ possible outcomes.
Above, when you calculate the outcome, what you are calculating is the number of ways, right? A.k.a “number of combinations of n things taken x at a time” with
, yes?

But does it take into account that there are marbles of two different colors here?
I'm really quite at loss, so sorry if I'm totally wrong and stupid.

4. ## Re: Red marbles, white marbles, in a bag.

Originally Posted by Sabre
Above, when you calculate the outcome, what you are calculating is the number of ways, right? A.k.a “number of combinations of n things taken x at a time” with , yes?
But does it take into account that there are marbles of two different colors here?
I'm really quite at loss, so sorry if I'm totally wrong and stupid.
Suppose that $r$ is the number of red balls in the sample, $0\le r\le 5$.
Then $8-r$ is the of blue balls in the sample. Right?

$\mathcal{P}(r)=\dfrac{\dbinom{5}{r}\dbinom{10}{8-r}}{\dbinom{15}{8}}$

5. ## Re: Red marbles, white marbles, in a bag.

"Additionally, how would you calculate the probability of my getting at least 1 red marbles out of 8? At least 2; 3; 4; 5?
And how do you calculate that

The simplest way to do that is to look at the opposite. If you don't get "at least one red marble", you must have gotten all 8 blue. There are a total of 15 marbles, 10 of which are blue. The probabability the first marble is blue is 10/15= 2/3. There are now 14 marbles, 9 of them blue so the probability the second marble is also blue is 9/14. Continuing in that way, the probability all 8 are blue is (10/15)(9/14)(8/14)...(2/7)(1/6) which we could write as (10!)(15- 10)!/(15!)= (10!)(5!)/(15!). The probability of "at least one red marble" is 1 minus that:
1- (10!)(5!)/(15!).

6. ## Re: Red marbles, white marbles, in a bag.

I think I understood. I mean I can place the logic in my head now. Let's see if I got this right.

In a bag with 10 white marbles and 3 red marbles I take 7 without replacement:
Finding the probabilities of getting 1 red marble means comparing the number of ways I can obtain exactly 1 red marble and 6 white marbles (desirable outcome) when drawing 7 marbles to all possible outcomes when drawing 7 marbles.

A. First I calculate the number of all possible combinations when taking 7 out of 13.

${13\choose7} \,=$ (13!)/(7!)(13-7)!= 1,716 possible combinations

Then I calculate the number of ways I can obtain my desirable outcome of 1 red and 6 white, which is the number of combinations for obtaining 1 red out of 3 multiplied by the number of combinations for 6 out of 10 white.

${3\choose1}{10\choose6} \:=$((3!)/(1!)(3-1)!)*((10!)/(6!)(10-6)!) = (3)(210) = 630 ways of obtaining the desirable outcome

Then I calculate P which is

$\mathcal{P}(1 red)=\:\frac{630}{1716}=\:\frac{3}{8}=\:\0,37$
__________________________________________________ __________________________________________________ ________________

B. To find the probability of 2 reds marbles we have:

$\mathcal{P}(2 red)=\dfrac{\dbinom{3}{2}\dbinom{10}{5}}{\dbinom{1 3}{7}}=\:\frac{252}{1716}=\:\0,15$

Yeah, thanks again everybody, I was confused about the notion of 'number of ways' which is actually only the number of combinations for a particular outcome.

7. ## Re: Red marbles, white marbles, in a bag.

Originally Posted by Sabre
I think I understood. I mean I can place the logic in my head now. Let's see if I got this right.
In a bag with 10 white marbles and 3 red marbles I take 7 without replacement:
Finding the probabilities of getting 1 red marble means comparing the number of ways I can obtain exactly 1 red marble and 6 white marbles (desirable outcome) when drawing 7 marbles to all possible outcomes when drawing 7 marbles.
A. First I calculate the number of all possible combinations when taking 7 out of 13.
[texto ]{13\choose7} \,=[/tex] (13!)/(7!)(13-7)!= 1,716 possible combinations
Then I calculate the number of ways I can obtain my desirable outcome of 1 red and 6 white, which is the number of combinations for obtaining 1 red out of 3 multiplied by the number of combinations for 6 out of 10 white.
${3\choose1}{10\choose6} \:=$((3!)/(1!)(3-1)!)*((10!)/(6!)(10-6)!) = (3)(210) = 630 ways of obtaining the desirable outcome
Then I calculate P which is
$\mathcal{P}(1 red)=\:\frac{630}{1716}=\:\frac{3}{8}=\:\0,37$
__________________________________________________ __________________________________________________ ________________
B. To find the probability of 2 reds marbles we have:
$\mathcal{P}(2 red)=\dfrac{\dbinom{3}{2}\dbinom{10}{5}}{\dbinom{1 3}{7}}=\:\frac{252}{1716}=\:\0,15$
Yeah, thanks again everybody, I was confused about the notion of 'number of ways' which is actually only the number of combinations for a particular outcome.
Why the h_ll did you change the question in midstream?
It seems to someone who has taught this for many years, this is nonsense.
You have no idea what any of this means!

8. ## Re: Red marbles, white marbles, in a bag.

Did I get the answers right?
What do you mean I changed the question midstream?
If you mean why I changed the number of marbles, it was to see if I could to the calculation.
Apparently not?

Please could you make your reply more useful. I really don't have any idea what you mean.


# To prove that a mathematical statement is false is it enough to find a counterexample?

I am trying to show if the following statements are true or false.

1. Is it true that $|a + b| = |a| + |b|$ for general vectors $a$ and $b$?

2. If $a \cdot b = a \cdot c$ for equally-sized non-zero vectors $a$, $b$, $c$, does it follow that $b = c$?

For the first one I found a counterexample that shows that the statement is false.

If vector $a=\langle 1,4,5\rangle$ and $b=\langle 2,2,2\rangle$ then $|a|+|b|=\sqrt{42}$+$2\cdot\sqrt{3}=9.945$, and then, $|a+b|=\sqrt{1^2+4^2+5^2+2^2+2^2+2^2}=7.348$,

then we can conclude that $9.945 \ne7.348$ and the statement is false. Also by the triangle identity $|a + b| \le |a| + |b|$

For the second statement I also found an counterexample that proves that is false. If vector $a=\langle 1,0,0\rangle$, $b=\langle 0,1,0\rangle$ and $c=\langle 0,0,1\rangle$, we will obtain the following dot product:

$a \cdot b = 0$

$a \cdot c = 0$

then $a \cdot b = a \cdot c = 0$ and $b \ne c$

My question is:

To prove the two statements is it enough to find a counterexample and say if it is true or false. Or should I try to provide a more mathematical proof like induction or contradiction?

• It suffices to find a counterexample to show that a statement is not true. – Student Feb 17 '17 at 18:26
• Yes, this is enough. The only thing that is unclear is your statement "Also by the triangle identity $|a + b| = |a| \le |b|$". First, did you mean $|a + b| - |a| \le |b|$? Second, what do you mean to prove by this? – Théophile Feb 17 '17 at 18:29
• Okay, I see it was a typo. But more importantly, you should realize that citing the triangle inequality is not enough to answer the question, because it doesn't in itself contradict statement (1). The triangle inequality should suggest to you that you can probably find $a,b$ such that $|a+b| < |a|+|b|$, which would contradict statement (1), but you don't need to mention the inequality. Showing that counterexample (as you did) is the real proof. (I just noticed that @zipirovich effectively made the same comment about this in their answer below.) – Théophile Feb 17 '17 at 19:27
• In response to Einsteins theory of relativity, a book titled A Hundred Authors Against Einstien had been written. When asked about the book, Einstein retorted by saying “Why 100 authors? If I were wrong, then one would have been enough!” – steven gregory Feb 17 '17 at 22:45
• @palsch: I think you mean "example that refutes an assertion or claim". – John Bentin Feb 19 '17 at 12:47

When considering a statement that claims that something is always true or true for all values of whatever its "objects" or "inputs" are: yes, to show that it's false, providing a counterexample is sufficient, because such a counterexample would demonstrate that the statement it not true for all possible values. On the other hand, to show that such a statement is true, an example wouldn't be sufficient, but it has to be proven in some general way (unless there's a finite and small enough number of possibilities so that we can actually check all of them one after another).

So logically speaking, for these two specific examples, you're right — each one can be demonstrated to be false with an appropriate counterexample. And both your counterexamples do work, but make sure that the math supporting your claim is right: in the first example you computed $|a+b|$ incorrectly.

By the way, the reference to the triangle inequality is a good touch, but it doesn't prove anything. Rather, it's a very strong hint that suggests that there have got to be examples when the inequality rather than equality holds.

• So, is it not correct to mention the triangle inequality in this case? – user290335 Feb 17 '17 at 19:00
• Here's my opinion on problem-solving in general, proof questions in particular. First there's the process of looking for a solution or a proof, thinking about it -- and in this example, the triangle inequality is an important hint suggesting that the statement is false. But then we write up a final narrative of a solution or proof, without any sidetracking notes and such -- and for this problem the triangle inequality wouldn't be there. – zipirovich Feb 17 '17 at 19:04
• In short, saying that this statement is false by the triangle inequality would not qualify as a proof. The triangle inequality per se does not claim that vectors with $|a+b|<|a|+|b|$ exist. It claims that $|a+b|\le|a|+|b|$ for all $a$ and $b$. Note that logically even if "$|a+b|=|a|+|b|$" were true for all $a$ and $b$, that wouldn't contradict the triangle inequality. – zipirovich Feb 17 '17 at 19:07
• I wouldn't even call the triangle inequality a strong hint. I am sure part of the purpose in giving this assignment was to convince the students that the triangle inequality cannot be strengthened into an equality, by having them find counterexamples themselves. – Paul Sinclair Feb 17 '17 at 22:34
• @PaulSinclair: I partially agree with you, and partially don't. I agree that that's part of the purpose of the exercise. But what I meant was that from a student's perspective reasoning could go like this: I need to prove or disprove "$|a+b|=|a|+|b|$" -> they taught us the triangle inequality saying that $|a+b|\le|a|+|b|$ -> why didn't they make it equals? -> either they are not telling the truth, or in fact it's not always equals and thus had to be less or equal -> so I guess I should be looking for a counterexample. – zipirovich Feb 17 '17 at 23:37

If a statement ${\cal S}$ is of the form "all $x\in A$ have the property $P$" then a single $x_0\in A$ not having the property $P$ proves that the statement ${\cal S}$ is wrong.

But not all statements are of this form. For example the statement ${\cal S}\!:\>$"$\pi$ is rational" cannot be disproved by some "easy" counterexample, but only by means of hard work.

Yes, any counterexample will do. It's often instructive to look for the simplest counterexample. For example, take the one-dimensional vector space $\Bbb R$ and the vectors $a=1$ and $b=-1$ in the case of the first statement.

If the statement is true, then you give a mathematical proof. Since you can't find all feasible inputs to prove that the statement is true, even computers can't do this for some statements.

If the statement is false, then you give one counter example. Since the statement says that it is true for all the feasible inputs, you just have to find one feasible input which doesn't satisfy the statement.

As for your solutions, everything's seem correct with two mistakes. $a+b$ in the first example is <3,6,7> and triangle inequality is $|a+b| \leq |a|+|b|$.

• I did a mistake. I edited my question. Thank you for your help. – user290335 Feb 17 '17 at 18:41
• Glad to be of help @user290335 – rookie Feb 18 '17 at 10:10
• Someone downvoted this. Can I know what to improve in this answer? – rookie Feb 18 '17 at 10:10

As other answers have explained, if you have a claim that something is true for all possible inputs, then a single counterexample disproves the claim. Period.

Perhaps, though, you may have some lingering doubt about how "generic" the counterexample is. Sure, maybe we can prove that $\lvert a+b \rvert = \lvert a \rvert + \lvert b \rvert$ is false for $a=(1,4,5)$ and $b=(2,2,2)$. However, for all we know, this might be the only counterexample. We already know the claim is false (beyond any doubt), but maybe it's only "technically" false. Maybe it's true "in the typical case", and we just happened to find the only exception.

For example, suppose I claim "$x^4 + y^4 \ne z^4$ for all integers $x$, $y$, and $z$". You say, "That's not true: $0^4 + 1^4 = 1^4$". You'd be right: Indeed my claim is incorrect. But if you're willing to let me move the goal posts a little, I can easily salvage the claim by excluding "trivial" counterexamples like $0^4 + 1^4 = 1^4$. The claim remains true "in the typical case" - "technically" false but true "in spirit".

Most of the time you won't see people explicitly address how "generic" their counterexample is. They'll just give one counterexample and be done. And implicitly, they're saying that this one counterexample is convincing enough that the claim is "generally" false. Because:

When a statement is false, it's "generally" false... generally.

This belief is completely non-rigorous and not formally justified, but that's okay - there was no formal meaning for "typical case", "generally true/false", and "trivial" to begin with.

How could we make a more convincing argument that a statement is not only false, but "generally" false?

Depending on the situation, we might try to show that:

• There are infinitely many counterexamples (not just one)
• There are infinitely many counterexamples that aren't just obvious variations of each other (e.g. not just constant multiples of each other)
• The set of counterexamples has infinite volume
• A random input (drawn from a chosen probability distribution) is a counterexample with probability $1$

... the list goes on. In the most fortunate case, we can find a definite answer by describing exactly which inputs satisfy the claim and which ones don't. For example, it turns out that "$\lvert a+b \rvert = \lvert a \rvert + \lvert b \rvert$" is true if and only if $a$ and $b$ are positive scalar multiples of each other, or one or both of them is $0$. This is a rigorous statement which is stronger than merely disproving "$\lvert a+b \rvert = \lvert a \rvert + \lvert b \rvert$ for all $a$ and $b$", and can be informally interpreted as saying that "$\lvert a+b \rvert = \lvert a \rvert + \lvert b \rvert$" is "usually" false.

These are the ways you could go beyond proving that a claim is false, to prove that it's "very" false.

But enough talk about false statements being "generally false" or "only technically false". It's still false. All such talk involves moving the goal posts, replacing the original statement with a different one.

For whatever actual, specific claim you might be considering, one counterexample is enough to disprove it.


# Question about Distributive Laws of Logic and proof of the Symmetric Difference

Here is the definition of the Symmetric Difference: $$A \Delta B = (A \backslash B) \cup (B \backslash A),$$ Our goal is to prove: $$A \Delta B = (A \cup B) \backslash(A \cap B).$$

I want to prove this and at the same time to check if my understanding of the Distributive Laws of Logic is correct.

My main goal is about Distributive Laws of Logic. I want to know if I can always break the parenthesis with this method.

I know that there are similar proofs in the website but I feel that I need help with the Distributive Laws.

Please check if this is correct:

We start with

$(x \in A$ $\land$ $x \notin B)$ $\vee$ $(x \notin A$ $\land$ $x \in B)$

This is the part that I want to know if I am correct, and I want to know if I can do this for any parenthesis regarding of what is inside of the parenthesis of the right part:

$(x \in A$ $\land$ $x \notin B)$ $\vee$ x $\notin$ A ) $\land$

$(x \in A$ $\land$ $x \notin B)$ $\vee$ x $\in$ B )

Now we can use the classic version of the Distributive Law:

$(x \in A$ $\vee$ x $\notin$ $A$ ) $\land$

$(x \notin B$ $\vee$ x $\notin$ $A$ ) $\land$

$(x \in A$ $\vee$ x $\in$ $B$ ) $\land$

$(x \notin B$ $\vee$ x $\in$ $B$ )

Now we can simplify:

******Universe****** $\land$

$(x \notin B$ $\vee$ x $\notin$ $A$ ) $\land$

$(x \in A$ $\vee$ x $\in$ $B$ ) $\land$

******Universe******

Finally we have,

$(x \in A$ $\vee$ x $\in$ $B$ ) $\land$

$(x \notin B$ $\vee$ x $\notin$ $A$ )

The last step is to use the Morgan Laws

$(x \in A$ $\vee$ x $\in$ $B$ ) $\land$

$\neg$ $(x \in A$ $\land$ $x$ $\in$ $B$ )

That is our goal:

Q.E.D.

• I just happened to see this! I suppose 'pinging' me in a comment to your own question does not work ... anyway, yes, your proof is fine! And yes, you can use Distribution on part of a statement just as you are using DeMorgan on just part of the statement in your last step. Sep 28 '17 at 3:42
• @Bram28 Thank you so much again for your amazing teachings! Sep 28 '17 at 14:50
• You're welcome! And by the way, I definitely see your progress with this material!! :) Sep 28 '17 at 14:52
• @Bram28 I have been using your teachings about Latex and Mathematical Logic. You are fantastic! Thank you so much! Sep 28 '17 at 15:16
• :) I appreciate your kind words ... but you are doing the learning! Sep 28 '17 at 15:17

## 1 Answer

Yes, that is a permissible application of distribution.

It is basically using the proof for the quadratic distribution: $$(s\wedge t)\vee (u\wedge v)~{= (s\vee (u\wedge v))\wedge(t\vee (u\wedge v))\\ =(s\vee u)\wedge(s\vee v)\wedge(t\vee u)\wedge (t\vee v)}$$

Take an arbitrary $x$ such that $x\in (S\cap T)\cup(U\cap V)$.   By definition of union and disjunction, this is equivalent to $(x\in S\wedge x\in T)\vee(x\in U\wedge x\in V)$.   By distribution, that is equivalent to $(x\in S\vee(x\in U\wedge x\in V))\wedge (x\in T\vee(x\in U\wedge x\in V))$, and distributing again that is $(x\in S\vee x\in U)\wedge (x\in S\vee x\in V)\wedge (x\in T\vee x\in U)\wedge (x\in T\vee x\in V)$. Thus it is equivalent to $x\in(S\cup U)\cap (S\cup V)\cap (T\cup U)\cap (T\cup V)$.

More succinctly, using the set algebra:

$$(S\cap T)\cup(U\cap V)~{=(S\cup(U\cap V))\cap(T\cup(U\cap V))\\=(S\cup U)\cap (S\cup V)\cap (T\cup U)\cap (T\cup V)}$$

Just substitute the relevant sets.

If we presume complementation relative to some superset $\mathcal U$ (the "universe") of both $A,B$, then your proof is essentially:

\def\sm{\smallsetminus} {\begin{align} &\quad (A\Delta B) \\ &= (A\sm B)\cup(B\sm A) &&\text{definition of symmetric difference} \\& = (A\cap B^\complement)\cup(B\cap A^\complement) &&\text{definition of set minus} \\& = (A\cup (B\cap A^\complement))\cap(B^\complement\cup (B\cap A^\complement)) && \text{distribution} \\& = (A\cup B)\cap(A\cup A^\complement)\cap (B^\complement\cup B)\cap (B^\complement\cup A^\complement)&&\text{distribution} \\& = (A\cup B)\cap\mathcal U\cap\mathcal U\cap (B^\complement\cup A^\complement)&&\text{complementation} \\&= (A\cup B)\cap(B^\complement\cup A^\complement) && \text{identity} \\&= (A\cup B)\cap(A^\complement\cup B^\complement) && \text{commutivity} \\&= (A\cup B)\cap(A\cap B)^\complement & & \text{deMorgan's Rule} \\&= (A\cup B)\sm(A\cap B) && \text{definition of set minus}\end{align}}

• Thank you so much! Amazing answer! I like very much the idea to treat the problem with Set Laws. In that way, the solution can be reduced to few steps. Sep 29 '17 at 16:45
• I am using your teaching to apply set rules instead of logic rules and it reduces the work to be done at least 50%. Thank you so much! Oct 2 '17 at 21:28


# Is the statement “1/3 of the natural numbers are divisible by 3” true? Is anything similar to it true?

If we're talking about a finite set of the natural numbers, like those between 1 and 500 or 1 and a million, it seems to me that the fraction of numbers in that finite set that have a factor of 5 approaches $1/5$ as the set increases in size. Like roughly $1/2$ of all numbers in such a set have a factor of 2, roughly $1/3$ have a factor of 3, and so on; and this approximation grows less "rough" and more exact as the size of the set increases.

So, can we say that out of the entire set of the natural numbers, exactly $1/5$ are divisible by 5? Or perhaps that the limit of the fraction of the natural numbers less than or equal to a given n divisible by a given integer approaches 1/that integer as n approaches infinity?

(I would love to know how to ask this question with proper notation.)

-
There was a similar thread some time ago, see math.stackexchange.com/questions/101768/… and especially the first answer. –  Gregor Bruns Aug 26 '12 at 21:12
Am I correct in assuming that this question has already been answered in enough forms that it isn't a helpful addition to the site? I don't mind deleting if so; the idea of "asymptotic density" is something I didn't know about until today, and now that I can learn about that I at least have something to work with. How do I delete, if I ought to? –  Annick Aug 26 '12 at 21:14
Yours is certainly a good question and it doesn't seem a duplicate to me. If I didn't knew the title of the linked question I probably wouldn't have been able to find it. I was merely referencing so that you can benefit from the answers there. Please keep asking. –  Gregor Bruns Aug 26 '12 at 21:27
@Annick Now that there are several answers, I'd just leave it. If several people want to close it as a duplicate, we can, but it'll still exist for others to see. –  Graphth Aug 26 '12 at 21:27
@Annick I would just like to add that this is a very well-asked question, and that I'm sure you will get positive responses in the future if you continue to ask questions in this manner. –  Alex Becker Aug 26 '12 at 21:31

This can indeed be made formal. To formalize the statement "$x$ fraction of natural numbers satisfy the property $P$", we define the function $$f(n)=\text{ number of natural numbers }\leq n\text{ which satisfy }P$$ and write $\lim\limits_{n\to \infty} \frac{f(n)}{n}=x$. In your first case, the function $f$ is given by $f(n)=\lfloor n/3\rfloor$ and the statement becomes $$\lim\limits_{n\to\infty} \frac{\lfloor n/3\rfloor}{n}=\frac{1}{3}$$ which is easily seen to be true, since $\frac{1}{3}-\frac{1}{n}\leq \frac{\lfloor n/3\rfloor}{n}\leq \frac{1}{3}$. Similar results hold for any natural number in place of $k$.

-
Be careful, however: mathematically speaking, the cardinality of numbers divisible by 3 is equal to the cardinality of all numbers! These are two very different counting mechanisms being used. –  akkkk Aug 26 '12 at 21:39
holy god, what the :/ –  orokusaki Aug 27 '12 at 1:13
This formal statement is exactly the definition of natuarl density or asymptotic density. –  Ken Bloom Aug 27 '12 at 2:54

Look up natural density or asymptotic density.

-

Here are the positive integers divisible by $3$: $$3,6,9,12,15,18,21,\ldots$$ Here are those not divisible by $3$: $$1,2,4,5,7,8,10,11,\ldots$$ Now suppose we just alternate between the first list and the second: $$\begin{array}{} 3 & & & & 6 & & & & 9 & & & & 12 & & & & 15 & & & & \cdots\cdots \\ & \searrow & & \nearrow & & \searrow & & \nearrow & & \searrow & & \nearrow & & \searrow & & \nearrow & & \searrow & & \nearrow \\ & & 1 & & & & 2 & & & & 4 & & & & 5 & & & & 7 \end{array}$$

Then we could argue in the same way that half of all positive integers are divisible by $3$.

It does make sense to say $1/3$ of them are divisible by $3$, understanding that statement in a certain context, but defining that context is something that will bear examination.

-
Why does it not make sense? It doesn't make sense in the sense of cardinality, but it makes perfect sense in the sense used in the other answers. –  joriki Aug 26 '12 at 23:00
Sorry: typo. I've fixed it. –  Michael Hardy Aug 26 '12 at 23:16
I think a slightly more formal way to say this would be, “the cardinality of the natural numbers divisible by 3 is the same as the cardinality of the natural numbers indivisible by 3.” –  bdesham Aug 27 '12 at 3:03
@bdesham : That may be more formal but it's not exactly the same thing. Cardinality is only one related concept; there are others. –  Michael Hardy Aug 27 '12 at 3:21
....in particular; I didn't intend the arrows to indicate a one-to-one correspondence, but only the order in which the numbers appear in a sequence. –  Michael Hardy Aug 27 '12 at 3:22

If one computes the fraction of positive integers from $1$ to $m$ that are a multiple of $n$, we get a sequence whose limit is $\frac{1}{n}$ as $m\to \infty$. If we ask about the size of the set of positive integers which are multiples of $n$ compared to that of all positive integers, the answer is that they are the same in some sense as they are both countably infinite.

-


# Erase every other number from $1, 2, 3, … 2000$ until only one number left

One writes $$1, 2, 3, ... 2000$$ on the blackboard.

We erase every other number from left, so after one iteration we are left with $$2, 4, ... 2000$$

Then we erase every other number from right..

We keep repeating to erase from left and right one after another, eventually there is only one number left.

What would be that number?

I wrote a program, unless there is a bug, the answer should be 982. But is there a way to mathematically induce the results, and generalize to arbitrary number (not just 2000?)

Following the suggestion, it seems like for power of 2, the answers go like this

$$N=2$$, final number is 2

$$N=4$$, final number is 2

$$N=8$$, final number is 6

$$N=16$$, final number is 6

$$N=32$$, final number is 22

$$N=64$$, final number is 22

$$N=128$$, final number is 86

$$N=256$$, final number is 86

The answer will jump to 4 times previous answer minus 2, for every time we multiply $$N$$ by 4...

• To start, I 'd work out what the final number was with lower caps (here, $2000$ is the cap). See if you can spot a pattern. – lulu May 10 '20 at 19:59
• as always, do the problem by hand with smaller sets. 1,2,3 to start. Then 1,2,3,4. There is an odd/even aspect to this, and 2000 is 16 times 125, so you might get the first similar behavior for 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16. – Will Jagy May 10 '20 at 19:59
• I'd start by looking at what happens if you write the numbers in base $2$. – JonathanZ supports MonicaC May 10 '20 at 20:10
• See the relevant OEIS sequence for formula. – Momo May 10 '20 at 20:18
• @Blue thanks! quite a fun read! – Vlad Zkov May 10 '20 at 23:50

Here's a step, at least, toward a solution.

Let $$S(N)$$ denote the "surviving" number as a function of $$N$$. Now after the first pass from left to right, only the even numbers from $$2$$ up to $$2\lfloor N/2\rfloor$$ remain. Thus $$S(N)$$ satisfies the recursion

$$S(N)=2(\lfloor N/2\rfloor+1-S(\lfloor N/2\rfloor))$$

with $$S(1)=1$$ (i.e., once only one person, that person survives). Let's see first how this works for a power of $$2$$:

\begin{align} S(32)&=2(17-S(16))\\ &=34-4(9-S(8))\\ &=-2+8(5-S(4))\\ &=38-16(3-S(2))\\ &=-10+32(2-S(1))\\ &=54-32\\ &=22 \end{align}

Now let's look at $$N=2000$$:

\begin{align} S(2000)&=2(1001-S(1000))\\ &=2002-4(501-S(500))\\ &=-2+8(251-S(250))\\ &=2006-16(126-S(125))\\ &=-10+32(63-S(62))\\ &=2006-64(32-S(31))\\ &=-42+128(16-S(15))\\ &=2006-256(8-S(7))\\ &=-42+512(4-S(3))\\ &=2006-1024(2-S(1))\\ &=2006-1024\\ &=982 \end{align}

as the OP found. Whether the recursive formula can be simplified to an explicit closed formula I'll leave to someone else.

Here is the complete solution, using the excellent recurrence of Barry Cipra.

Consider the $$k$$-bit-long binary representation of $$N = b_1 b_2 b_3 \dots b_k$$ where $$b_1$$ is the most significant bit.

For convenience define $$B_j = b_1 b_2 \dots b_j = \lfloor N / 2^{k-j}\rfloor$$, i.e. the number formed by the most significant $$j$$ bits. Note that $$B_k = N$$ and $$B_1 = b_1 = 1$$.

Next we "unwind" the recurrence a bit:

\begin{align} S(N) = S(B_k) &= 2(B_{k-1} + 1 - S(B_{k-1}))\\ &=2(B_{k-1} + 1) - 2 [ 2(B_{k-2} + 1 - S(B_{k-2}) ] \\ &=2(B_{k-1} + 1) - 4(B_{k-2} + 1) + 4 S(B_{k-2}) \end{align}

A nice thing now happens: if I may abuse notation a bit and mix up numbers with their binary representations (in red),

$$2B_{k-1} - 4B_{k-2} = \color{red}{b_1 b_2 \dots b_{k-2} b_{k-1} 0 - b_1 b_2 \dots b_{k-2} 0 0 = b_{k-1}0} = 2b_{k-1}$$

where the binary representations (in red) have some appended $$0$$s at the end to represent multiplication by $$2$$ or $$4$$. So now we can unwind faster:

\begin{align} S(B_k) &= 2(b_{k-1} -1) + 4S(B_{k-2}) \\ &=2(b_{k-1} -1) + 4[2(b_{k-3} - 1) + 4 S(B_{k-4})]\\ &=2(b_{k-1} -1) + 8(b_{k-3} - 1) + 2^4 S(B_{k-4})\\ &=2(b_{k-1} -1) + 8(b_{k-3} - 1) + 32(b_{k-5}-1) + \dots \end{align}

Note that the subscript $$j$$ of the remaining $$S(B_j)$$ term decreases by $$2$$ for each unwinding step. So what happens at the end of all the unwinding can be case-analyzed:

For odd $$k$$: the last remaining term will be $$S(B_1) = S(b_1) = S(b_1) = b_1 = 1$$:

$$S(B_k) = \sum_{j = 1, 3, 5...} 2^j (b_{k-j} - 1) + 2^{k-1} S(B_1) = \sum_{j = 1, 3, 5...} 2^j (b_{k-j} - 1) + 2^{k-1} b_1$$

Interpretation: Based on the way I number the bits, $$2^j b_{k-j}$$ is the $$b_{k-j}$$ bit evaluated at its correct place-position. So the formula is equivalent to this recipe:

Recipe: Take the most significant bit's place-value (blue), and consider the $$2$$nd, $$4$$th, $$6$$th, etc least significant bits (red), i.e. the bits for place-values $$2^1, 2^3, 2^5,$$ etc. If a bit is $$0$$, then subtract its place-value.

E.g. $$2000 = 11111010000 = \color{blue}{1}\color{red}{1}1\color{red}{1}1\color{red}{0}1\color{red}{0}0\color{red}{0}0 \implies S(2000) = 1024 - 2 - 8 - 32 = 982$$

E.g. $$64 = 1000000 = \color{blue}{1}\color{red}{0}0\color{red}{0}0\color{red}{0}0 \implies S(64) = 64 - 2 - 8 - 32 = 22$$

For even $$k$$: the last remaining term will be $$S(B_2)$$. Luckily, $$B_2 \in \{2, 3\}$$ and in both cases $$S(B_2) = S(2) = S(3) = 2$$.

$$S(B_k) = \sum_{j = 1, 3, 5...} 2^j (b_{k-j} - 1) + 2^{k-2} S(B_2) = \sum_{j = 1, 3, 5...} 2^j (b_{k-j} - 1) + 2^{k-1} b_1$$

So surprisingly, the same recipe works! The only clarification is that since the most significant bit is also an even-numbered least-significant bit (because $$k$$ is even), it must not be included in the subtraction.

E.g. $$32 = 100000 = \color{blue}{1}0\color{red}{0}0\color{red}{0}0 \implies S(32) = 32 - 2 - 8 = 22$$

Further remarks:

• It is curious that only half the bits matter. E.g. the recipe immediately shows $$S(8) = S(1000_2) = S(13) = S(1101_2)$$.

• Barry's recurrence is already $$\log(N)$$ time, so my recipe is not faster. However, it does give an explicit summation.

• The explicit summation, especially in the form of the recipe, allows easy proofs of the OP's observation that $$S(2^k)$$ values come in pairs, and $$S(2^{k+2}) = 4S(2^k) - 2$$.

• Thanks that's great answer! – Vlad Zkov May 14 '20 at 2:00


# Recreational math: If $f(f(x))=e^x$, bound the integral $\int_0^1 f(x)dx$

I've been studying functions $f:\mathbb R\to\mathbb R$ that satisfy $f(f(x))=e^x$ (or, half-iterates of the exponential function). I know that there's only one such analytic function, but it's really hard to study since it is almost certainly non-elementary and I only know how to find finitely many terms of its Maclaurin Series.

Instead, I'm studying all continuous and increasing functions $f$ satisfying $f(f(x))=e^x$, and I've alighted on the following problem (which I came up with out of curiosity). I propose this question to all interested residents of MSE:

Given that $f$ is continuous and increasing and $f(f(x))=e^x$, find some bounds for the integral $$\int_0^1 f(x)dx$$

I've managed to come up with some pretty sweet bounds (in fact, they are the best possible bounds), and I'll post them after this question gets some answers.

I'll accept whatever answer has the tightest bounds, with a proof.

NOTE: Most people probably wouldn't think of this as recreational "fun" math, but hey, I did it for fun, and I'm proposing it as a problem to be done just for fun. So please try to enjoy it, and please don't try to close it.

• Anyone care to explain the close vote? – Frpzzd May 15 '18 at 23:43
• Well, puzzle problems like this aren't really what MSE is for, though I've seen such questions before and enjoyed them greatly. That being said, this seems like an interesting question, so I'm definitely not going to vote to close :) - Brevan, from Close Votes Review – Brevan Ellefsen May 16 '18 at 3:33
• To me, the most interesting thing here isn't the question itself, but your proof technique for showing your bounds are tightest. Was it simply due to construction, or did you simply play around till you found really good bounds and then found a juicy proof? – Brevan Ellefsen May 16 '18 at 3:38
• @BrevanEllefsen Oh, I found the juicy proof right off the bat using graphical techniques and functional equations. – Frpzzd May 16 '18 at 14:24

Suppose $f(x)$ is an increasing, continuous function satisfying $f(f(x))=e^x$. Then there must be some $\alpha\in(0,1)$ such that $f(\alpha)=1$. We can compute \begin{align*} \int_\alpha^1 f(x)\,dx&=\int_\alpha^1 e^{f^{-1}(x)}\,dx\\ &=\int_0^\alpha e^u\,df(u)\\ &=e^\alpha f(\alpha)-e^0f(0)-\int_0^\alpha f(u)e^u\,du\\ &=e^\alpha-\alpha-\int_0^\alpha f(x)e^x\,dx. \end{align*} So, we have $$\int_0^1 f(x)\,dx=\left(\int_0^\alpha+\int_\alpha^1\right) f(x)\,dx=e^\alpha-\alpha-\int_0^\alpha(e^x-1)f(x)\,dx.$$ For $0< x< \alpha$, we have $\alpha< f(x)< 1$, and thus $$1=e^\alpha-\alpha-\int_0^\alpha e^x\,dx<\int_0^1 f(x)\,dx<e^\alpha-\alpha-\int_0^\alpha \alpha e^x\,dx=(1-\alpha)e^\alpha+\alpha^2.$$ For $0< \alpha< 1$, the quantity $(1-\alpha)e^\alpha+\alpha^2$ takes a maximum value of $2+\log^2(2)-\log(4)$ at $\alpha=\log(2)$, so we have bounds $$1<\int_0^1 f(x)\,dx < 2+\log^2(2)-\log(4)\approx 1.0942.$$

These bounds are sharp: for $0\leq x\leq \log(2)$, we can take $f(x)$ to be an arbitrary continuous, strictly increasing function satisfying $f(0)=\log(2)$ and $f(\log(2))=1$, then extend $f$ to a continuous increasing function on the entire real line satisfying $f(f(x))=e^x$ by iteratively using the relation $f(x)=e^{f^{-1}(x)}$. To make $\int_0^1 f(x)\,dx$ arbitrarily close to the lower bound, we can choose $f(x)$ to be close to $1$ for an arbitrarily large portion of the interval $[0,\log(2)]$, and to make the integral arbitrarily close to the upper bound, we can choose $f(x)$ to be close to $\log(2)$ for an arbitrarily large portion of the interval $[0,\log(2)]$.

• The exact value seems to be 1.02525, so +1 :) – Oldboy May 16 '18 at 16:18
• I suspect this is the same as OP’s answer, as he says the difference between bounds is 0.1. – Szeto May 16 '18 at 22:26
• @JulianRosen Wowie zowie, this is exactly my answer (though I preferred $2\ln 2$ to $\ln 4$). This is so similar to my proof that you've essentially saved me the trouble of writing an answer (however, I do intend to demonstrate to everyone that these are the best possible bounds, unless you get around to it first). – Frpzzd May 18 '18 at 1:08
• I have edited the answer to better explain the sharpness. – Julian Rosen May 18 '18 at 14:00
• @JulianRosen Well done, and I so hope that you enjoyed the problem (as was the purpose of my posting it). – Frpzzd May 18 '18 at 22:54

$\int_0^1f(x)dx=1.02525$, up to to five significant digits.

I tried to deal with this problem numerically by heavily using number crunching capabilities of Mathematica. I have simply supposed that:

$$f(x)\approx\sum\limits_{k=0}^nc_kx^k$$

Basically, you can pick $n$, calculate $f(f(x))$ and make a set of $n$ equations by matching the first $n$ coefficients of $x^k$ with the coefficients from Maclauirn's expansion of $e^x$. It's a highly non-lienar problem and I focused my efforts to find only one solution numerically. The trick is to use values $c_k$ obtained for $n-1$ as a starting point to calculate $c_k$ in the next iteration.

For $n=5$ I got something like:

$f(x)=0.503212 +0.884755 x+0.173988 x^2-0.0557584 x^3+0.17115 x^4+0.249233 x^5-0.159222 x^6-0.317672 x^7+0.172933 x^8+0.0335486 x^9$

Blue line represents $f(x)$, orange line represents $f(f(x))$ and green line represents $e^x$

But for $n=20$ I got something "almost" perfect:

$f(x)=-0.00110484 x^{19}+0.00423925 x^{18}-0.00285303 x^{17}-0.00653605 x^{16}+0.00430471 x^{15}+0.0114125 x^{14}-0.00188582 x^{13}-0.0167065 x^{12}-0.00616185 x^{11}+0.0170445 x^{10}+0.0165896 x^9-0.00860714 x^8-0.0207938 x^7-0.00356292 x^6+0.0140354 x^5+0.00731033 x^4+0.0207005 x^3+0.243846 x^2+0.876672 x+0.498799$

...with $\int_0^1f(x)dx=1.02526$

For $n=25$ I did not see much improvement.

I stopped at $n=30$. This is my final result:

$f(x)=3.19108553894\cdot 10^{-6} x^{29}-0.0000320371 x^{28}+0.000102301 x^{27}-0.0000852623 x^{26}-0.000155577 x^{25}+0.000202985 x^{24}+0.0003114 x^{23}-0.000304959 x^{22}-0.000659598 x^{21}+0.00024257 x^{20}+0.00120893 x^{19}+0.000250339 x^{18}-0.00172616 x^{17}-0.00138061 x^{16}+0.00165885 x^{15}+0.00293783 x^{14}-0.000399194 x^{13}-0.00403302 x^{12}-0.00203198 x^{11}+0.00346346 x^{10}+0.00438265 x^9-0.00094675 x^8-0.0047584 x^7-0.00170557 x^6+0.00287885 x^5+0.00131622 x^4+0.0240847 x^3+0.246667 x^2+0.876334 x+0.498618$

...with $\int_0^1f(x)dx=1.02525$

This value did not change even for $n=40$.

• I am not sure if the OP is looking fot this kind of answer. The OP looks for bounds, not a value, because the function needs not to be analytic. – Szeto May 16 '18 at 22:23
• My bounds are $1.02525\pm0.00001$ :) – Oldboy May 17 '18 at 4:06
• I really appreciated your tedious computation, but I think this function itself is paradoxical(see the important edit in my answer). Can you explain or resolve the paradox? – Szeto May 17 '18 at 15:04
• I don't get your paradox. First you are stating that $f^{-1}(a)=b$ which basically means that $a=f(b)$ which is fine. But why is $\ln f(b)=f^{-1}(b)$? – Oldboy May 17 '18 at 20:17
• because the fuction can be defined as $$f(x)=e^{f^{-1}(x)}$$. – Szeto May 17 '18 at 22:02

IMPORTANT EDIT:

I find that $f(x)$ can create some paradoxical result.

Assume $0<a<1$(which is the region of interest) and $f^{-1}(a)=b$. Then $0<b<a$.

Then, $$a=f(b)\implies \ln a=\ln f(b)=f^{-1}(b)$$

Clearly, $L.H.S.\le0$. However, we have proved that $f^{-1}(b)=R.H.S.>0$.

Can anyone resolve it?

END EDIT

Not a tight bound, but too long for a comment.

Assume the $f(x)$ is:

1. Continuous
2. A real function on the interval $(-\infty,\infty)$
1. Strictly increasing

Since $f(x)$ is strictly increasing, it has a well-defined inverse $f^{-1}(x)$.

Let’s redefine the function as $$f(x)=e^{f^{-1}(x)}$$

Firstly, since $e^x$ is positive for all real $x$, hence $f(x)$ is strictly positive.

Secondly, we are interested in the fixed point of $f(x)$. For fixed points $(t,f(t))$, $$t=f(t)= f^{-1}(t)$$

Thus, $$t=e^t$$ which has no real solution.

Therefore, we can see $y=f(x)$ has no intersection with $y=x$.

With these two observations, one can deduce $f(x)>x$ for all $x$.

$$f(x)>x\implies \int^1_0f(x)dx>\int^1_0xdx=\frac12$$

EDIT

From $$f(x)>x$$ we have $$f(f(x))>f(x)$$ $$e^x>f(x)$$ $$e-1>\int^1_0f(x)dx$$

EDIT 2:

I think that $f(0)$ cannot be defined(but maybe okay in the sense of limit).

Assume $f^{-1}(0)=C$.

It is easy to prove $f^{-1}(x)$ is strictly increasing.

Thus, from $f(x)>x$, we get $x>f^{-1}(x)$. So $C<0$.

We also observe that, due to $f(x)>0$, $f^{-1}(x)$ is undefined for $x<0$. Since $f(x)$ is defined wherever its inverse is defined, so $f(x)$ is undefined in $(0,-\infty)$.

$$f^{-1}(0)=C\implies f(C)=0$$

But $C<0$, $f(C)$ should be undefined! Also, I have proven that $f(C)>0$(above). That leads to a contradiction.

So a value of $C$ does not exist, and hence $f^{-1}(0)$ and $f(0)$ is undefined.

From the above observations, we can also see: $$0<f^{-1}(x)<x$$.

• I had this idea building on yours, to prove that $f(x) < e^x$. Suppose on the other hand that there was $x_0$ such that $f(x_0) \geq e^{x_0}$. Then $f(x_0) \geq e^{x_0} = f(f(x_0)) \geq f(e^{x_0}) \geq f(x_0)$ which means that $f(f(x_0)) = f(e^{x_0}) = e^{x_0}$, a fixed point, which as you showed doesn't exist. Hence $f(x) < e^x$. There's a good chance I have made a mistake, but it provides a fairly good upper bound if it's right? It assumes that the function is strictly increasing again. – Cataline May 16 '18 at 11:17
• @Cataline Yeah, I came up with this idea while bathing a few minutes ago(before seeing you comment). I’ve added a short, straight forward derivation of the upper bound. – Szeto May 16 '18 at 11:47
• Indeed, your upper bounds are correct. But are they the best possible bounds? – Frpzzd May 16 '18 at 14:25
• @Frpzzd I’ve never seen ways to prove bounds to be the best. I would certainly be amazed by your proof. – Szeto May 16 '18 at 14:36
• @Szeto Well, I don't plan to post it until this gets at least a couple more answers. – Frpzzd May 16 '18 at 14:41


# Why does plotting Collatz sequences in polar coordinates produce a cardioid and nephroid?

I generated the Collatz sequences for the first 2,000 starting integers, and plotted these sequences "on top of each other" in polar coordinates, using a fixed radius and with each element in the sequence as theta (converted to radians, i.e., modulo 360). Successive elements within each sequence are connected by (semi-transparent) lines.

Following these steps produced the image below, where we can clearly see two shapes (a cardioid and nephroid). (The Python code that generates this image is available here. The total number of elements in the 2,000 sequences is 136,100, so the total number of lines plotted in the image below is 136,100 - 2,000 = 134,100.)

Link to generated image (high-quality) or lower quality

My question is: Why do a cardioid and nephroid clearly appear? Is there something notable about the Collatz sequences that produce these shapes, or is this unrelated to the intricacies of the Collatz sequences, and that other unrelated integer sequences also produce similar shapes?

As of now, I haven't seen any substantive references online to nephroids and the Collatz conjecture together.

A post here describes how you can generate a cardioid in polar coordinates by drawing lines between evenly spaced points on a circle, but this doesn't relate to the Collatz sequences, and doesn't construct a nephroid.

Update:

Based on the discussion, the cardioid can be generated based on the envelope of lines drawn between points around a circle, with each line drawn between point line between points n and 2n (mod N), as described here. The nephroid is based on the same concept for points between n and 3n, as described here. The Collatz sequence contains both behaviors: some elements in sequence follow 2n->n (the order of the two doesn't matter if we are connecting lines), and some elements follow n->3n+1 (but the +1 component is negligible for the overall shape), resulting in the cardioid and nephroid.

Update #2:

Per a suggestion by heropup below, I've redrawn the image where for each line connecting terms (N,N+1) in a sequence, the line is red if N+1 > N and blue if N+1 < N. From this and per the update above, we can clearly see that the nephroid is red and the cardioid is blue.

Link to colored generated image (high-quality) or lower quality

(This now probably looks better on a white background but takes a long time to generate).

• Welcome to MSE ! If only all newcomers could write questions with this quality, this is a very interesting question ! Jan 30, 2021 at 18:01
• In such construction, you are basically joining n with 2n and 3n+1. The post you mentioned in the last paragraph explains why lines n–2n create a cardioid. I suppose that lines n–3n+1 will be responsible for nephroid. Jan 30, 2021 at 18:10
• modular arithmetic in multiplication tables of 2 and 3 (youtube.com/watch?app=desktop&v=qhbuKbxJsk8) Jan 30, 2021 at 18:11
• Hi @samerivertwice, for any given Collatz sequence, I convert this sequence to radians using Python's math.radians function, and treat this value as the angular coordinate θ. The radial coordinate r is fixed at 1 for all values. I plot (θ,r) for all values for all sequences, and connect consecutive values within a sequence with lines. Feb 1, 2021 at 2:23
• Here's a suggestion. For each line in your figure, color it red if it is the result of the next term of the sequence going from a smaller number to a larger one, and blue if it is the result of the next term going from a larger number to a smaller one. What do you see? Feb 1, 2021 at 2:53

Based on the discussion, the cardioid can be generated based on the envelope of lines drawn between points around a circle, with each line drawn between point line between points n and 2n (mod N), as described here. The nephroid is based on the same concept for points between n and 3n, as described here. The Collatz sequence contains both behaviors: some elements in sequence follow $$2n\to n$$ (the order of the two doesn't matter if we are connecting lines), and some elements follow $$n\to3n+1$$ (but the $$+1$$ component is negligible for the overall shape), resulting in the cardioid and nephroid.


# Moment of inertia of regular polygonal frames

The moment of inertia with respect to the orthogonal barycentral axis on the plane where it lies:

• a homogeneous triangular (equilateral) frame is equal $I_C = (1)\,\frac{M\,L^2}{6}$;
• a homogeneous quadrangular frame is equal $I_C = (2)\,\frac{M\,L^2}{6}$;
• a homogeneous pentagonal (regular) frame is equal $I_C = \left(2+\frac{3}{\sqrt{5}}\right)\frac{M\,L^2}{6}$;
• a homogeneous hexagonal (regular) frame is equal $I_C = (5)\,\frac{M\,L^2}{6}$;
• a homogeneous heptagon (regular) frame is equal $I_C = \dots \,$ boh;
• a homogeneous octagon (regular) frame is equal $I_C = \left(5+3\,\sqrt{2}\right) \frac{M\,L^2}{6}$;
• $\dots$

Is there a formula to write that moment of inertia for any regular polygon frame?

I emphasize the fact that these are frames, not laminates.

Thank you.

Thanks to the answers we received, for any regular $n$-sided polygon of side $L$:

• $\text{perimeter} = n\, L$;
• $\text{fixed_number} = \frac{1}{2\,\tan\left(\frac{\pi}{n}\right)}$;
• $\text{apothem} = \text{fixed_number}\cdot L$;
• $\text{area} = \, \frac{\text{perimeter}\cdot \text{aphotem}}{2}$;
• $\text{moment_inertia}_C = \frac{M\,L^2}{12} + M\,\text{apothem}^2$ (homogeneous frame of mass $M$);

and for completeness (and also for curiosity) I also add:

• $\text{moment_inertia}_C = \frac{\frac{M}{2}\,L^2}{12} + \frac{M}{2}\,\text{apothem}^2$ (homogeneous lamina of mass $M$).
• So what is $L$? – David G. Stork Sep 29 '17 at 22:53
• With frames, I clearly assuming the boundary of the respective polygonal lamina. L is the length of the side. Thank you. – TeM Sep 29 '17 at 23:11
• So the total circumference is $nL$? Please be more careful and thorough when posing questions. I'm not going to take time now to go back and fix my solution. – David G. Stork Sep 29 '17 at 23:14
• I tried to illustrate the problem. If anyone was able to give me a hand I would be grateful to him! – TeM Sep 29 '17 at 23:37
• And why is $C$ not the origin? What difference does the location make? None of your answers depend upon the center location. – David G. Stork Sep 29 '17 at 23:49

The moment of inertia of a bar around the perpendicular axis through the center is $\frac{mL^2}{12}$. In your case $m=\frac{M}{N}$. Using the parallel axis theorem, the moment of inertia of a bar with respect to an axis at distance d from the center is $$\frac{mL^2}{12}+md^2$$ so the total moment of inertia for your system is $$I_N= \frac{ML^2}{12}+Md_N^2$$ Now all you need to do is calculate what is the distance $d_N$ from the center of a regular polygon with $N$ sides to the side. In the case $N=3$, $d_3=\frac{L}{2\sqrt{3}}$, for $N=4$ $d_4=\frac{L}{2}$ and so on. You have $$\tan\frac{2\pi}{2N}=\frac{L/2}{d}$$

• Excellent, the formula collimation with the data calculated above, thank you! – TeM Sep 30 '17 at 13:17

To calculate these moments of inertia, we must simply integrate one side and multiply the result by n.

If we imagine C to be the origin, a side can be expressed as $x = \frac{L}{2\tan(\frac\pi n)}, -\frac L2 < y<\frac L2$. We can easily integrate to find moment of inertia of this segment:

$$I_C\cdot L = \int^{\frac L2}_{-\frac L2}\frac{M}n\cdot D(x, y)^2dy = \frac{M}n\int^{\frac L2}_{-\frac L2}\left(\sqrt[]{x^2+y^2}\right)^2dy = \frac{M}n\int^{\frac L2}_{-\frac L2}\left(\frac{L^2}{4\tan^2(\frac\pi n)} + y^2\right)dy\\ =\frac{M}n\left(\frac{L^2}{4\tan^2(\frac\pi n)}y + \frac13y^3\right)\biggr|^{\frac L2}_{-\frac L2} = \frac{M}n\cdot\left(\frac{L^3}{4\tan^2(\frac\pi n)} + \frac{L^3}{12}\right).$$

Simply multiplying by $n$ yields the desired moments:

$$I_C=M\left(\frac{L^2}{4\tan^2(\frac\pi n)} + \frac{L^2}{12}\right)$$

• Thank you too! I think there is an error: mass density is not M/L, but M/(nL); in this way the result collides with that of Andrei and in turn all the above particular cases (verifiably in literature) are embedded! – TeM Sep 30 '17 at 12:25


# U-substitution problem

1. Nov 30, 2015

### Mr Davis 97

1. The problem statement, all variables and given/known data
$\displaystyle \int \frac{\ln x}{x(1 + \ln x)} dx$

2. Relevant equations

3. The attempt at a solution

Let $u = 1 + \ln x$, then $\ln x = u - 1$
$\displaystyle du = \frac{1}{x}dx$
Thus, $\displaystyle \int \frac{\ln x}{x(1 + \ln x)} dx = \int \frac{u - 1}{u} du= \int 1 - u^{-1} du = u - \ln u + C = 1 + \ln x - \ln \left | \ln x + 1\right | + C$

However, this is the wrong answer. What am I doing wrong?

2. Nov 30, 2015

### Ray Vickson

Why do you think it is wrong?

3. Nov 30, 2015

### Mr Davis 97

Because my answer book says that the answer should be $\ln x - \ln | \ln x + 1 | + C$ I have a 1 in there, which is where the answer differs.

4. Nov 30, 2015

### ehild

Is not C+1 a constant?

5. Nov 30, 2015

### Mr Davis 97

Does that mean as my final answer I should redefine C + 1 as just C, since they are both just constants? Why did I get a 1 in the first place, while other ways of obtaining the solution don't have the 1? Such as letting u be just lnx instead of lnx + 1?

6. Dec 1, 2015

### Samy_A

When you integrate, you find one result, one primitive of the function you integrate.
Now, if the function $f$ is the the primitive you found, $f+C$ ($C$ any constant) will also be a primitive. So yes, you can remove the +1, or leave it, both results are correct. Removing the +1 makes the answer somewhat more elegant, but there is nothing more to it than that.

7. Dec 1, 2015

### Ray Vickson

You got the '1' in the first place because YOU chose to define u as 1 + ln(x).

Anyway, why are you obsessing on this issue? It as absolutely NO importance: the constant of integration is totally arbitrary, and can be called 147.262 + K instead of C, if that is what you prefer. It can be called anything you want, and if somebody else chooses to call it something different from what you choose to call it, that is OK, too. If you use a computer algebra system to do the indefinite integral, it might not a constant of integration (but it might include your "1" if it happened to use your change-of-variable method).


# Why is $1/i$ equal to $-i$?

When I entered the value $$\frac{1}{i}$$ in my calculator, I received the answer as $-i$ whereas I was expecting the answer as $i^{-1}$. Even google calculator shows the same answer (Click here to check it out).

Is there a fault in my calculator or $\frac{1}{i}$ really equals $-i$? If it does then how?

• Hint $i^2 = -1$ – Mann May 11 '15 at 12:14
• Multiply by $i/i$. – David Mitra May 11 '15 at 12:14
• Hint $$z=\frac{1}{i}\iff zi=1\implies \dots$$ – John Joy May 11 '15 at 12:56
• Three down votes for someone exhibiting natural mathematical curiosity and having the wherewithal to ask about it is shameful. – Emily May 11 '15 at 14:50
• Excellent question I wondered that myself when I read it. I could say $+1$ but given the context of the question I should say $+i$! – Math Man May 13 '15 at 1:04

$$\frac{1}{i}=\frac{i}{i^2}=\frac{i}{-1}=-i$$

Note that $i(-i)=1$. By definition, this means that $(1/i)=-i$.

The notation "$i$ raised to the power $-1$" denotes the element that multiplied by $i$ gives the multiplicative identity: $1$.

In fact, $-i$ satisfies that since

$$(-i)\cdot i= -(i\cdot i)= -(-1) =1$$

That notation holds in general. For example, $2^{-1}=\frac{1}{2}$ since $\frac{1}{2}$ is the number that gives $1$ when multiplied by $2$.

• I appreciate that this answer gives context to the calculation. +1 ! – pjs36 May 11 '15 at 15:04

There are multiple ways of writing out a given complex number, or a number in general. Usually we reduce things to the "simplest" terms for display -- saying $0$ is a lot cleaner than saying $1-1$ for example.

The complex numbers are a field. This means that every non-$0$ element has a multiplicative inverse, and that inverse is unique.

While $1/i = i^{-1}$ is true (pretty much by definition), if we have a value $c$ such that $c * i = 1$ then $c = i^{-1}$.

This is because we know that inverses in the complex numbers are unique.

As it happens, $(-i) * i = -(i*i) = -(-1) = 1$. So $-i = i^{-1}$.

As fractions (or powers) are usually considered "less simple" than simple negation, when the calculator displays $i^{-1}$ it simplifies it to $-i$.

$-i$ is the multiplicative inverse of $i$ in the field of complex numbers, i.e. $-i * i = 1$, or $i^{-1} = -i$.

$$\frac{1}{i}=\frac{i^4}{i}=i^3=i^2\cdot i = -i$$

By the definition of the inverse $$\frac1i\cdot i=1.$$

This agrees with

$$(-i)\cdot i=1.$$

$$\frac{1}{i}=\left|\frac{1}{i}\right|e^{\arg\left(\frac{1}{i}\right)i}=$$

$$1e^{\left(-\frac{1}{2}\pi\right) i}=e^{\left(-\frac{1}{2}\pi\right) i}=$$

$$1\left(\cos\left(-\frac{1}{2}\pi\right)+\sin\left(-\frac{1}{2}\pi\right)i\right)=\cos\left(-\frac{1}{2}\pi\right)+\sin\left(-\frac{1}{2}\pi\right)i=$$

$$0+(-1)i=0-1i=-i$$

So:

$$\frac{1}{i}=-i$$

Why is $\left|\frac{1}{i}\right|=1$:

$$\left|\frac{1}{i}\right|=\sqrt{\Re\left(\frac{1}{i}\right)^2+\Im\left(\frac{1}{i}\right)^2}=\sqrt{0^2+(-1)^2}=\sqrt{(-1)^2}=\sqrt{1}=1$$

Second wat to show $\left|\frac{1}{i}\right|=1$:

$$\left|\frac{1}{i}\right|=\frac{|1|}{|i|}=\frac{\sqrt{1^2}}{\sqrt{1^2}}=\frac{\sqrt{1}}{\sqrt{1}}=\sqrt{\frac{1}{1}}=\sqrt{1}=1$$

• How do you know that $|1/i|=1$??? – JP McCarthy May 11 '15 at 17:24
• @JpMcCarthy look in the edit! – Jan May 11 '15 at 17:30
• This is the most convoluted way of explaining this that I have ever seen, albeit correct and in some ways more mathematically interesting than the conventional ones. – Laertes May 11 '15 at 17:33
• I think it's the easiest way! – Jan May 11 '15 at 17:36
• How did you know that the imaginary part of $1/i$ is $-1$??? – JP McCarthy May 12 '15 at 6:50

I always like to point out that this fits well into a pattern you see when "rationalising the denominator", if the denominator is a root: $$\frac{1}{\sqrt{2}} = \frac{1}{\sqrt{2}}\cdot \frac{\sqrt{2}}{\sqrt{2}} = \frac{1}{2}\sqrt{2}$$ $$\frac{1}{\sqrt{17}} = \frac{1}{\sqrt{17}}\cdot \frac{\sqrt{17}}{\sqrt{17}} = \frac{1}{17}\sqrt{17}$$ $$\frac{1}{\sqrt{a}} = \frac{1}{\sqrt{a}}\cdot \frac{\sqrt{a}}{\sqrt{a}} = \frac{1}{a}\sqrt{a}$$ $$\frac{1}{i} = \frac{1}{\sqrt{-1}} = \frac{1}{\sqrt{-1}}\cdot \frac{\sqrt{-1}}{\sqrt{-1}} = \frac{1}{-1}\sqrt{-1} = - i.$$ In this vein, it is almost more suggestive to write $$\frac{1}{\sqrt{2}} = \frac{\sqrt{2}}{2}$$ $$\frac{1}{\sqrt{17}} = \frac{\sqrt{17}}{17}$$ $$\frac{1}{i} = \frac{i}{-1}.$$


# CHEFPRMS - EDITORIAL

Setter: Misha Chorniy
Editorialist: Taranpreet Singh

Easy

### PREREQUISITES:

Prime Sieve, or even Square root factorization would suffix, Pre-computation. Number-theory (optional).

### PROBLEM:

Answer the queries of form, Given a number N, can this number be represented as sum of two semi-primes. Semi-prime is a product of any two distinct prime numbers.

### SUPER QUICK EXPLANATION

• Pre-compute all primes up to MXN (MAX possible value of N) (or MXN/2 will also suffice). Calculate all Semi-primes by iterating over all pair of distinct primes.
• Now, calculate all possible sums which can be represented as sum of two semi-primes, by taking each pair of semi-prime.
• Answer queries in O(1) time using pre-computed values.

### EXPLANATION

For this problem, I am explaining two solutions, Common approach as used by Setter and Tester as well as most teams. The other one is quite an overkill, strange way to solve this problem, used by editorialist only.

Setter/Tester Approach

Calculate all the primes in range [2,MXN]. This can be done using Sieve of Eratosthenes or we can just naively check each number whether it is a prime or not.

For those unaware of Sieve of Eratosthenes, Enter the secret box.

Click to view

We create an array and initially, mark all numbers above 1 as prime. Then, we select number marked as prime which is not yet visited. For this prime, mark all its multiples as composite. We repeat this process until there are no prime left which are not visited yet. After this, only numbers not marked as composite are prime.

Now that we have the list of primes in an array, say pr. Now, we need to find the list fo semi-primes. we can iterate over all pairs of Distinct primes take their product and the values in range [1, MXN] are marked as semi-prime. So, now we have the list of semi-primes in range$[1, MXN]$.

Now, Computing final answer is just doing once again, Iterating over all pairs of semi-primes and if their sum is in range [1, MXN], mark the sum as reachable.

Answering queries become simple, as we just need to print whether the sum N is marked reachable or not.

Editorialist’s Approach (Not recommended at all )

This solution differs from above solution at the computation of list of semi-primes. Give a try to compute list of semi-primes without computing primes. It relies on the formula of Number of factors of a number.

The observation is, that all semi-primes have exactly four factors. (can also be proved eaisly) But, all numbers having four factors are of two types. Both semi-primes and perfect cubes will always have 4 factors. So, we iterate over all numbers, check if it has exactly four factors (including trivial factors) and is not perfect cube. If any number satisfy both criteria, it is marked as semi-prime.

After that, this solution is same as Author/Tester solution.

### Time Complexity

Both Solutions have pre-computation time O(MXN^2) for iterating over all pairs of semi-primes, which dominates everything.

For a fact, Sieve of Eratosthenes takes O(N*log(logN)) time while Square root factorization takes O(N*\sqrt{N}) time.

Queries are answered in O(1) time, taking overall O(T) time.

SO, overall complexity is O(MXN^2).

### AUTHOR’S AND TESTER’S SOLUTIONS:

Feel free to Share your approach, If it differs. Suggestions are always welcomed.

Why my solution is flagged as wrong answer?I have checked for 200 input and it works on codechef practice compiler.link of my solution.
Logic used:
Every semi-prime number Has exactly two distinct prime factor and used ‘count’ variable to count it.
Also used ‘cnt’ variable to take care of repeated prime factor.

I solved this with a modified seive. We can calculate the semi-primes in the seive function itself and later simply iterate till N/2th number to check for semi-primes.
Time complexity: 0(N loglogN + N).
Have a look : https://www.codechef.com/viewsolution/20952615

//


# What is the difference between “into isomorphism”and “onto isomorphism”?

Kronecker's theorem: Let $F$ be a field and $f(x)$ a nonconstant polynomial in $F[x]$. Then there is an extension field $E$ of $F$ in which $f(x)$ has zero.

Proof: Since $F[x]$ is a unique factorization domain, $f(x)$ has an irreducible factor say $p(x)$. Now consider the ideal $\langle p(x)\rangle$ of the ring of polynomials generated by $p(x)$. Since $\langle p(x)\rangle$ is irreducible over $F$ then the ideal $\langle p(x)\rangle$ is a maximal ideal of $F[x]$. Consequently, $F[x]/\langle p(x)\rangle$ is a field.

Write $E=F[x]/\langle p(x)\rangle$.

Now we shall show that the field $E$ satisfies every part of the theorem. Now consider the map

$\phi:F\rightarrow E$ defined as $\phi (a)=a+\langle p(x)\rangle$.

This mapping is well defined as any element $a\in F$ can be regarded as a constant polynomial in $F[x]$.

$\phi$ is injective

for $\phi (a)=\phi(b)$

$\implies a+\langle p(x)\rangle=b+\langle p(x)\rangle$

$\implies a-b\in\langle p(x)\rangle$

$a-b=f(x)p(x)$ for some $f(x) \in F[x]$.

Since $\deg(p(x))\geq 1$ then $\deg(f(x)g(x))\geq 1$ while $\deg(a-b)=0$. Hence, $f(x)=0$. Consequently, $a-b=0 \implies a=b$.

Clearly, $\phi$ is an homomorphism.

Thus $\phi$ is an isomorphism from $F$ into $E$.

What is the difference between the phrases “$\phi$ is an isomorphism from $F$ into $F'$” and “$\phi$ is an isomorphism from $F$ onto $F'$”?

Actually, I'm proving Kronecker's theorem and the first phrase arose in the middle of the proof (last line). I got confused as it stated the first phrase just by showing $\phi$ is a homomorphism and injective without showing it is surjective.

Please clarify my doubt, if possible with the help of an example.

• Kronecker's Theorem seems to be something else. Could you give a link to the result and its proof you are working on? – Dietrich Burde May 29 '17 at 14:57
• The latter means the mapping is onto (surjective), but isomorphisms are already surjective. – Sean Roberson May 29 '17 at 14:58
• @DietrichBurde:Wait,i'm typing the complete proof. – P.Styles May 29 '17 at 14:59
• @DietrichBurde There is a Kronecker's Theorem in field theory. – AspiringMathematician May 29 '17 at 14:59
• PK, how do you define an isomorphism? If you grasp that, you've answered your own question. – Erik G. May 29 '17 at 15:00

It's impossible to know without having a reference to the textbook or lecture notes you're reading.

Some texts use “isomorphism” where the more common terminology, nowadays, is “injective homomorphism” or “monomorphism”. Apparently, your textbook or lecture notes fall in this category. You should check where the book defines “isomorphism”; most probably it says the equivalent of “injective homomorphism”: this terminology was rather common until a few decades ago.

The first part proves that $\phi$ is an injective homomorphism and the second part proves surjectivity.

Actually, proving $\phi$ is injective is not needed: as soon as $\phi$ is a homomorphism that maps $1$ into $1$, it is automatically injective, because its kernel is an ideal and the ideals in a field $F$ are just $\{0\}$ and $F$.

• :Yeah,the text i'm reading is very old.I've cross checked the proof of this theorem from Gallian's text & Dummit & foote's text.In both texts proof is almost similar both of these texts stated about injectivity and operation preserving property of $\phi$ but the text i'm reading named it as "into isomorphism" specifically. – P.Styles May 29 '17 at 16:00
• @PKStyles You should check where the book defines “isomorphism”; most probably it says “injective homomorphism”. This was very common until a few decades ago. – egreg May 29 '17 at 16:03
• :There is no mention of injective homomorphism while defining the map but i think in place injective isomorphism it should be injecttive homomorphism. – P.Styles May 29 '17 at 16:07
• @PKStyles Can you tell what book it is? – egreg May 29 '17 at 16:08
• :Advanced course in Modern Algebra by Gupta & Gupta. – P.Styles May 29 '17 at 16:10

It could be just a matter of emphasis (but do see the comments below), so it would be more about writing style than mathematics. If $\phi$ is an isomorphism, then it is already both injective and surjective, but I would imagine that the author is thinking something like

• Saying "$\phi$ is an isomorphism from $F$ into $F'$" emphasizes to the reader that the target of the map $\phi$ is $F'.$ Using the term into can be important when emphasizing that a map is well defined. Like you can declare that $F'$ is the codomain of $\phi$ all you want, but when you actually define what map $\phi$ does to elements of $F$, the result better be in $F'$. Sometimes there is a little work to showing that $\phi(x) \in F'$ for all $x \in F$, and saying that $\phi$ maps $F$ into $F'$ captures the idea that this was checked.

• Saying "$\phi$ is an isomorphism from $F$ onto $F′$" emphasizes that the map is surjective, which is possibly the reason the author brought up the fact that $\phi$ is an isomorphism in that part of the argument.

• Older texts use isomorphism for what we now use injective homomophism. It is not a matter of style, really. – Mariano Suárez-Álvarez May 29 '17 at 15:08
• @Mike Pierce:Will you please explain "the target of the map $\phi$ is $F'$"? – P.Styles May 29 '17 at 15:32
• @MarianoSuárez-Álvarez Oh, I had no idea. Then it become rather important where OP is reading this proof. Now I'm curious, how old do you mean when you say "older texts"? Like, are there texts that use isomorpism for injective homomorphism that are commonly referenced today? – Mike Pierce May 29 '17 at 15:34
• @MikePierce:From first point, you meant that $\phi$ is an isomorphism from $F$ onto "something" inside $F'$? – P.Styles May 29 '17 at 15:50
• @mike, this is quite common. Just google for "isomorphism into" (between quotes) in google, and go to books. Artin used it in his Geometric Algebra, Steenrod in his The topology of fiber bundles, and so on. – Mariano Suárez-Álvarez May 29 '17 at 16:19


The relationship between a partition of a set and an equivalence relation on a set is detailed. If A is an inﬁnite set and R is an equivalence relation on A, then A/R may be ﬁnite, as in the example above, or it may be inﬁnite. Equivalence Relations. Using equivalence relations to deﬁne rational numbers Consider the set S = {(x,y) ∈ Z × Z: y 6= 0 }. 1. Equivalence Relations 183 THEOREM 18.31. Properties of Equivalence Relation Compared with Equality. It is of course enormously important, but is not a very interesting example, since no two distinct objects are related by equality. . For any x ∈ ℤ, x has the same parity as itself, so (x,x) ∈ R. 2. 1. Another example would be the modulus of integers. In a sense, if you know one member within an equivalence class, you also know all the other elements in the equivalence class because they are all related according to $$R$$. Definition: Transitive Property; Definition: Equivalence Relation. We deﬁne a rational number to be an equivalence classes of elements of S, under the equivalence relation (a,b) ’ (c,d) ⇐⇒ ad = bc. Examples: Let S = ℤ and define R = {(x,y) | x and y have the same parity} i.e., x and y are either both even or both odd. Let R be the equivalence relation … 1. As the following exercise shows, the set of equivalences classes may be very large indeed. Equalities are an example of an equivalence relation. Suppose ∼ is an equivalence relation on a set A. An equivalence class is a complete set of equivalent elements. 1. Math Properties . 1. The parity relation is an equivalence relation. First, we prove the following lemma that states that if two elements are equivalent, then their equivalence classes are equal. Assume (without proof) that T is an equivalence relation on C. Find the equivalence class of each element of C. The following theorem presents some very important properties of equivalence classes: 18. For example, in a given set of triangles, ‘is similar to’ denotes equivalence relations. . 0. Proving reflexivity from transivity and symmetry. Explained and Illustrated . Equivalence relation - Equilavence classes explanation. . reflexive; symmetric, and; transitive. Example 5.1.1 Equality ($=$) is an equivalence relation. Exercise 3.6.2. Equivalent Objects are in the Same Class. Example $$\PageIndex{8}$$ Congruence Modulo 5; Summary and Review; Exercises; Note: If we say $$R$$ is a relation "on set $$A$$" this means $$R$$ is a relation from $$A$$ to $$A$$; in other words, $$R\subseteq A\times A$$. Equivalence Properties . . Remark 3.6.1. Algebraic Equivalence Relations . We will define three properties which a relation might have. Definition of an Equivalence Relation. . Let $$R$$ be an equivalence relation on $$S\text{,}$$ and let $$a, b … The relation \(R$$ determines the membership in each equivalence class, and every element in the equivalence class can be used to represent that equivalence class. Basic question about equivalence relation on a set. . We discuss the reflexive, symmetric, and transitive properties and their closures. A binary relation on a non-empty set $$A$$ is said to be an equivalence relation if and only if the relation is. An equivalence relation on a set S, is a relation on S which is reflexive, symmetric and transitive. Lemma 4.1.9. Then: 1) For all a ∈ A, we have a ∈ [a]. Note the extra care in using the equivalence relation properties. An equivalence relation is a collection of the ordered pair of the components of A and satisfies the following properties - Equivalence Relations fixed on A with specific properties. We then give the two most important examples of equivalence relations. Shows, the set of triangles, ‘ is similar to ’ denotes equivalence.. On S which is reflexive, symmetric equivalence relation properties and transitive ) is an equivalence relation on a a... Set a is an equivalence relation properties for example, in a given set of,. That states that if two elements are equivalent, then their equivalence classes equal.: transitive Property ; Definition: equivalence relation on S which is reflexive, symmetric and transitive of elements! Is of course enormously important, but is not a very interesting example, since no distinct... If two elements are equivalent, then their equivalence classes are equal, is a set!, in a given set of equivalent elements that if two elements are,. Not a very interesting example, in a given set of equivalences classes be... That states that if two elements are equivalent, then their equivalence are... Will define three properties which a relation on S which is reflexive, and... ’ denotes equivalence relations their equivalence classes are equal … Definition: transitive Property Definition. Example 5.1.1 Equality ( $=$ ) is an equivalence relation complete set of equivalences classes may be large... Note the extra care in using the equivalence relation … Definition: equivalence on. ( x, x has the same parity as itself, so ( x, has! ℤ, x has the same parity as itself, so (,! Relation properties x ∈ ℤ, x has the same parity as,... Discuss the reflexive, symmetric and transitive the following exercise shows, set... ∼ is an equivalence relation S, is a complete set of equivalences classes may be very indeed! Since no two distinct objects are related by Equality are equivalent, their! Are related by Equality which a relation on a set and an equivalence is! [ a ] distinct objects are related by Equality course enormously important, but is not very... Denotes equivalence relations be the equivalence relation is reflexive, symmetric and transitive a set S, a! We have a ∈ a, we have a ∈ [ a ] properties their! Set and an equivalence relation … Definition: transitive Property ; Definition: transitive Property Definition. Have a ∈ [ a ] ; Definition: transitive Property ; Definition: transitive Property ; Definition: relation. Exercise shows, the set of equivalent elements that if two elements equivalent..., is a complete set of equivalences classes may be very large indeed properties... A very interesting example, since no two distinct objects are related by Equality, is a might... Be the equivalence relation it is of course enormously important, but is not a very interesting example, no... Exercise shows, the set of equivalences classes may be very large indeed a set!, so ( x, x has the same parity as itself, so ( x x! 5.1.1 Equality ( $=$ ) is an equivalence relation equivalences classes may be very large.... X, x ) ∈ R. 2 equivalences classes may be very large indeed a. Then their equivalence classes are equal distinct objects are related by Equality related... Partition of a set and an equivalence class is a relation on a set is.... X ∈ ℤ, x has the same parity as itself, so ( x, )..., but is not a very interesting example, since no two distinct objects are by. A ] equivalence relation properties equivalence relation the following lemma that states that if elements. A very interesting example, since no two distinct objects are related Equality!, is a relation might have enormously important, equivalence relation properties is not a very interesting example, in a set..., so ( x, x ) ∈ R. 2 is similar ’! Equivalence relations S, is a relation might have ) for all ∈! Relation properties ∼ is an equivalence class is a relation on a S. Equivalence class is a complete set of triangles, ‘ is similar to ’ denotes relations...: transitive Property ; Definition: equivalence relation on a set and an equivalence relation on a S... = $) is an equivalence relation on S which is reflexive symmetric. It is of course enormously important, but is not a very interesting example, in given. Might have R. 2, the set of equivalences classes may be very large indeed transitive properties and closures... Define three properties which a relation might have are equal interesting example, a! S, is a complete set of equivalences classes may be very large indeed the two important... Transitive Property ; Definition: equivalence relation on a set a ($ = $) is equivalence... Give the equivalence relation properties most important examples of equivalence relations x, x the. Relationship between a partition of a set a no two distinct objects are related by Equality using. Relation on a set S, is a complete set of equivalent elements following lemma that states that if elements. Define three properties which a relation on a set S, is a complete set of triangles, ‘ similar! Equivalent elements ∈ ℤ, x ) ∈ R. 2 is a relation a... In using the equivalence relation properties ( x, x ) ∈ R. 2 let R be the equivalence properties... Are equivalent, then their equivalence classes are equal their equivalence classes are equal: equivalence properties! S, is a relation on a set is detailed equivalence classes are equal may be very indeed... Of equivalent elements all a ∈ a, we prove the following exercise shows the. Be very large indeed set and an equivalence class is a relation might have the extra care in using equivalence... 1 ) for all a ∈ a, we prove the following lemma that states that if two elements equivalent... Set is detailed of triangles, ‘ is similar to ’ denotes equivalence relations ∈ R. 2 equivalent.... We will define three properties which a relation might have equivalence class is complete. Between a partition of a set is detailed the extra care in using the equivalence relation on a a! Enormously important, but is not a very interesting example, in given. That if two elements are equivalent, then their equivalence classes are equal prove the following lemma that states if... [ a ] objects are related by Equality may be very large indeed a ∈,! We discuss the reflexive, symmetric, and transitive properties and equivalence relation properties.! Be the equivalence relation properties then: 1 ) for all a ∈ [ ]! All a ∈ a, we prove the following lemma that states that two! Complete set of equivalences classes may be very large indeed enormously important but... S which is reflexive, symmetric and transitive first, we have a ∈ [ a ] same as. 1 ) for all a ∈ [ a ] ) is an equivalence relation on set... As the following exercise shows, the set of equivalent elements if two are. Triangles, ‘ is similar to ’ denotes equivalence relations any x ∈ ℤ, has. Following exercise shows, the set of equivalences classes may be very large indeed as,... The reflexive, symmetric and transitive properties and their closures two distinct objects are related by Equality class a. Denotes equivalence relations let R be the equivalence relation on a set and an equivalence relation properties symmetric and properties! Relation might have states that if two elements are equivalent, then equivalence... Of equivalent elements: 1 ) for all a ∈ a, we have a ∈ [ a.... The two most important examples of equivalence relations, ‘ is similar to denotes... Two distinct objects are related by Equality similar to ’ denotes equivalence relations transitive properties and closures. Equality ($ = $) is an equivalence relation on a set is.! ($ = $) is an equivalence class is a complete set of equivalent.. Define three properties which a relation might have the equivalence relation same parity as itself so! A complete set of equivalent elements enormously important, but is not a very interesting example, in given. Equivalence relation properties let R be the equivalence relation on a set and an equivalence on... Similar to ’ denotes equivalence relations ) is an equivalence class is a on! In using the equivalence relation properties a, we prove the following lemma that states that if two elements equivalent!$ ) is an equivalence relation that states that if two elements are equivalent, then their equivalence are! On a set and an equivalence relation on a set S, is a on... That if two elements are equivalent, then their equivalence classes are equal,. … Definition: transitive Property ; Definition: transitive Property ; Definition: equivalence relation on S which is,. Suppose ∼ is an equivalence relation on a set S, is a complete of... Properties and their closures S, is a complete set of triangles, ‘ is similar ’! Which a relation on a set is detailed … Definition: transitive Property ; Definition transitive. Their equivalence classes are equal equivalence relations no two distinct objects are by! The two most important examples of equivalence relations important, but is not a very interesting,...

Skyrim Niselft Near Markarth, Dakota Electric Processing Fee, Best Pg In Vijay Nagar, Delhi, Zulm Ki Hukumat Full Movie, Island Day Trips From Nadi, Umdnj Radiology Phone Number, Dulux Easycare Colours, Pasulj Bez Zaprske,


# Different Probablities Same Situation?

1. Mar 25, 2009

### dkgolfer16

Johnny and Sally sit at a table in their dining room. Sally tells Johnny to leave the room while she prepares a game. Sally randomly selects three cards from a regular deck of cards (half black, half red) and places them face down on the table. She yells at Johnny to reenter and tells him that he gets to flip two of the three cards over. If two are of the same color, Johnny wins $2. If they are different colors, Sally wins$1.

Johnny's viewpoint: It's a great deal because I have a 50% chance of winning $2 and 50% chance of losing$1. Why does he think this? The first card color he flips over is of no difference. The second card he flips has a 50% chance of being either red or black, thus 50% chance of matching the first color.

Sally's viewpoint: It's a great deal because Johnny only has 33% chance of winning so theoretically I should pay him $3 if he wins. Why does she think this? Since three cards exist, the odds of flipping over two of the same color are 1 out of 3. Question: Who is right? Who will win? Are they somehow both right? Thanks for the help. 2. Mar 25, 2009 ### robert Ihnot If you reduced this to dealing two cards and asking the odds, how does that differ from chosing two cards at random from a deck of 52? 3. Mar 25, 2009 ### regor60 Johnny's right. By his logic. His expected value is 50 cents. Her logic is incomplete. If you focus on three cards, there are twelve combinations, 6 of which are of same color, therefore 50%. Even if he had a 1/3 chance of winning, it still wouldn't be a great deal, because her expected return is 0 with his$2 winning potential. Paying him \$3 would be to her disadvantage, her expected return would be negative 33 cents

Last edited: Mar 25, 2009
4. Mar 25, 2009

### dkgolfer16

That's what I thought. Johnny's right. But this link was posted to explain bell's inequality. Maybe i'm misunderstanding the example but it says the odds are on Sally's side. See "Is this game fair to you?" heading at the following address:

http://ilja-schmelzer.de/realism/game.php .

Correct me if I'm missing something.

5. Mar 25, 2009

### CRGreathouse

Johnny's essentially right -- though his expected winnings is more like 47 cents (8/17) because the deck isn't infinite.
In the link there are three preselected cards, two of the same color. In your example the three cards may be all the same color. Text comparisons:
"Sally randomly selects three cards from a regular deck of cards"
"I put three cards of my choice on the table"

6. Mar 25, 2009

### robert Ihnot

dkgolfer16: Sally randomly selects three cards from a regular deck of cards

That's not what the example says, it says: "I put three cards of my choice on the table so that you cannot see their color."

7. Mar 25, 2009

### dkgolfer16

Got it thanks