5

This question came up in my interview for a job application(you won't believe it but it was a C# programmer job application).

Let's say we have a open set $(0,1)$.

Can we say that there is a maximum value between $(0,1)$ or it is considered as undefined?

I answered that there is and it is

$$ 1 - \frac{1}{10^\infty} $$

But they said there isn't any max value. I still think my answer is correct.

Edit:

In some answers, it is basically said that:

$$ \frac{1}{10^\infty} > \frac{1}{2\cdot10^\infty} $$

Is this equation valid since there are infinite values in each side? I thought $$ 2\cdot\infty = \infty $$ and $$ \frac{\infty}{2} = \infty $$ So it doesn't matter how much you multiply or divide infinity, it is still infinity?

Sorry if the question is silly but I am a computer programmer, not mathematician.

  • 21
    $1/10^\infty$ is not a real number. – coffeemath Jan 22 '15 at 09:44
  • 18
    In C#, the set does have a maximum (1-FLT_EPSILON/2 in the float data type). – TonyK Jan 22 '15 at 10:41
  • 4
    @TonyK: and that's what I'd consider the "right" interview answer, unless it was presented as being a mathematics question. I guess since the interviewers said there wasn't a max, they didn't mean it to be a C# question, but personally I'd be reasonably well impressed by a candidate who made it one. – Steve Jessop Jan 22 '15 at 12:11
  • 2
    There is no '=' sign in '$\tfrac{1}{10^\infty} > \tfrac{1}{2\cdot10^\infty}$' so it is an inequality, not an equation. – CiaPan Jan 22 '15 at 13:20
  • 5
    $\infty$ is not a real number. Neither is $\frac1{10^\infty}$. (Before you ask, they're not complex numbers either…) – Akiva Weinberger Jan 22 '15 at 16:28
  • 1
    @TonyK Why did you divide FLT_EPSILON by 2? – Paul Manta Jan 22 '15 at 21:47
  • 1
    @PaulManta: Because the range $[\frac12,1)$ is twice as finely populated by floating-point numbers as the range $[1,2)$. By definition, 1+FLT_EPSILON is the smallest float that is greater than $1$; therefore the largest float that is less than $1$ is 1-FLT_EPSILON/2. – TonyK Jan 22 '15 at 22:14
  • Out of curiosity, did your incorrect answer negatively effect your interview? – Jonny Henly Jan 22 '15 at 23:29
  • @JonnyHenly, I really don't know. They told me there isn't and I am wrong. That's all I know. – ramazan polat Jan 23 '15 at 01:02
  • @coffeemath As soon as we define enough to make $1/10^\infty$ meaningful, that quantity will be the real number $0$, so it is real. Only some "sub-expressions" within it are not real. The problem is that the supremum of the interval, which is $1$ or (fancily) $1-\frac{1}{10^\infty}$, is not a member of that interval. – Jeppe Stig Nielsen Jan 23 '15 at 09:41
  • @SteveJessop, I thought it is a question about C# and since the last question before this question was about Double data type, I assumed that they ask for the maximum value of Double data type between open (0,1) set. My first answer was 1-Double.MinValue. Then they confirmed that it is not a C# question but math. – ramazan polat Jan 24 '15 at 07:50
  • @SteveJessop, my first answer was 1 - Double.MinValue. Then they said it's not a programming question and the (0,1) set is a real number line. So, it WAS a math question. – ramazan polat Aug 16 '15 at 22:16

8 Answers8

31

Your answer doesn't make much sense. It's equal to $1$ if anything (see Is it true that $0.999999999\ldots = 1$?).

You have to look at the definition: $m$ is the maximum if $m\in(0,1)$ and $\forall x\in(0,1),\ x\le m$. Clearly, this fails for any element $m\in(0,1)$ because $m<(m+1)/2<1$.

user2345215
  • 16,422
17

A maximum must be in the set. In the case of $(0,1)$ if $a \in (0,1)$ then the point $(1+a)/2$ is larger than $a$ and still in the set $(0,1).$ So there can be no max. There is a sup, namely $1,$ of the set $(0,1).$

coffeemath
  • 29,884
  • 2
  • 31
  • 52
16

That's a very creative answer, but infinity is tricky. If $$ 1 - \frac{1}{10^\infty} < 1 $$ would you not have to admit that $$ 1 - \frac{1}{10^\infty} < 1 - \frac{1}{2} \cdot \frac{1}{10^\infty} < 1 $$ as well? This would contradict your assertion that $1 - \frac{1}{10^\infty}$ was the maximum value of $(0,1)$.

You are right that this seems fishy, and this is the whole problem with treating infinity like a number. The only reasonable real number value of $\frac{1}{10^\infty}$ would be zero, so your number is $1$, and $1$ is not in the set.

6

The set has a supremum (equal to 1), but not a maximum.

4

For every $x\in(0,1)$ we can find an $y\in(0,1)$ (e.g. $y=\frac12+\frac12 x$) such that $x<y$. So no $x\in(0,1)$ is maximal in $(0,1)$.

drhab
  • 151,093
3

Mostly likely, the response they were looking for was a computer science answer, not a mathematician answer. As usual in interviews, they were probably more interested in the way you handled the question than your actual answer. I would have handled it something like this:

"Let's suppose we're storing 1.000... in a floating point variable. Now, we want to decrease that amount by the smallest amount we can. So the mantissa is going to go from all 0's to all 1's, and the exponent will increase by 1. How many bits is the mantissa? [say 10 for now] Okay good. The upper limit to the range (0, 1) is 1-2^-11. The leading 1 in the mantissa is implied but not physically stored, which is why the exponent is -11 instead of -10."

Next time an interviewer asks you any question that is difficult or open-ended, remember that they're more interested in the insight you demonstrate, your knowledge of the complexities, and your ability to view the problem from several different angles.

  • 5
    In interviews, as on the job, it's often in your best interest to answer a question with a question. For example:
    1. Do you want a pure mathematics answer or a computer science answer?
    2. Are we more concerned with rounding error or something else?
    3. Can you give me a little context? What are we trying to do?

    Any of these would give you insight into what they really want.

    – Jim Strieter Jan 22 '15 at 14:39
1

On the surface, it would appear that there is a maximum.

However an open set is just that - open. No matter how close you get to the upper limit (which is 1) you can never touch it - but you can get a teeny bit closer each time.

Now, in (your) practice, there is a maximum. The maximum would be whatever data type the decimal was cast as. It would be impractical in a program to allow for any size of number - as you can see a repeating decimal would quickly lock up a cpu!

Ramrod
  • 146
1

The mathematical side of the question has been dealt with in detail. But since you were applying for a job as a C# programmer, maybe they were (also) looking for a programming solution?

Floating point numbers have limited precision, i.e. they can only represent a finite number of different values. Therefore, the open interval $(0,1)$ does have a maximum: The next smallest number before the supremum $1$.

In C#, you can use the following trick to find this number (see https://stackoverflow.com/a/15332024/469708):

double supremum = 1;
long bitsOfSupremum = System.BitConverter.DoubleToInt64Bits(supremum);
double max = System.BitConverter.Int64BitsToDouble(bitsOfSupremum - 1);

On my machine the result is $0.99999999999999989$.