Friday, October 28, 2011

unknown question - random answer - probability via trial

If you choose an answer to this question at random, what is the chance that you will be correct?
a) 25%
b) 50%
c) 60%
d) 25%

Here are my musing - maybe correct - maybe not.

Assume (correctly?) that you do not know enough about the question and answer to know which is the correct answer.

But assume that one of the answers is correct.

There are four possibilities required* - (a) is correct, (b) is correct, (c) is correct, (d) is correct

( *this statement is a little naïve, but a full analysis using methods of probability would I think give you a similar 6/16 conclusion ... although it might produce a more satisfactory explanation )

Count the ticks (6) and the total cells (16) and here is your answer   37.5%   (longhand 6/16)

But does this feel right?

Well if there were just 3 choices (a), (b), (c) and no two answers were the same then you would think 33% (approx)

Note: That assumes that one of the answers is correct - an important assumption.

Preliminary Musings:

Answer is 37.5% providing that the original question is extended to say "...and one of the answers is correct"

Without assuming one of the answers is correct, my reasoning would be different (see below)

But 'Possibility 1' and 'Possibility 4' are the same I hear you cry?
'At random' in this case makes me think 4 trials...

To elaborate:- In my table layout, "(a) is correct" is different to "(d) is correct"

Here I have still ignored the actual text listed in the answers written.

Preliminary Musings 2:

Some reasoning and context: Assuming my answer 37.5% is correct, then going back to the original context ....

...we might say that "...none of the answers is correct" as only options available are 25%, 50%, and 60%

So "what is the chance that you will be correct" could only be answered with NO CHANCE (zero percent)


Looking at the actual answers and reasoning using logic.

25% being the correct answer would mean that (a) is correct answer and (d) is correct answer, but that would indicate 50% success of probability => (a) and (d) are wrong.

(b) being correct would give 25% probability of success, but answer lists 50% => (b) is wrong

(c) being correct would give 25% probability of success, but answer lists 60% => (c) is wrong

Therefore you must conclude that (a) is wrong, (b) is wrong, (c) is wrong, (d) is wrong

So "what is the chance that you will be correct" could only be answered with NO CHANCE (zero percent)

Why is this exercise so hard? Because it is a mixture of probability, logic, abstraction, intuition, counter-intuition, all of which are hard skills.

Saturday, October 8, 2011

Pure Mathematics and the horror of numbers

He was a pure mathematician who used to work entirely with abstract symbols, but had now sunk so low that his latest report contained actual numbers, indeed numbers with decimal points; that (he pretended) was the ultimate disgrace!

The above extract is from the excellent "The Man Who Loved Only Numbers"

I laughed quite hard when I read this :)

Saturday, October 1, 2011

logarithm of large number - it is not about computation!

Computer programmers who have not studied Mathematics beyond elementary level, often trip over this one.

Perhaps you asked yourself one of these questions:
Why does Gnu Gmp library not have a logarithm function?

What is the natural log of a large number such as 6775471000000000?

Rules of logs - product and powers:

For calculating logarithms of gigantic numbers - the standard ANSI C library is probably all that you need.

That computational tool, needs to be supplemented, with two pieces of Mathematical knowledge as illustrated here:

Images courtesy of Wikipedia (Creative Commons Licensed)

The number I mentioned above 6775471000000000 is too large for entry into a school standard calculator. Ten digits or so is the most you can enter.

Rewrite the number as 6775471 times 'a thousand million' and go that way.

Using the product of logs rule (graphic above) and doing the two calculations we see that:

log(6775471) = 15.728819  to 6 decimal places


log(1,000,000,000) = 20.723266 to 6 decimal places

Add the two answers together gives 36.452085 to 6 decimal places

Alternatively for the second piece of the addition you could have used 9log(10) by utilising the second rule - power of logs.

But my number is huge and does not contain a long stream of zeros?

This is all about precision. Do you really need more than say 6 or 8 decimal places?

Avoid creating artificial conditions. Unless you are working with numerical methods and/or in Engineering, then you will probably answer NO to what I just asked.

So your number is 6775471 followed by another 75 digits (some zero some not)

If you only need 6 digits of precision in your answer, then it matters not what those 75 digits contain, simply pretend they are zero, and either adapt my method shown or...

...use the 2nd log rule from the image above.
( hint: You might want to use 75log(10) as part of your workings. )

Answer Guess: Around 187.nnnnnn sounds about right.

Prime number searching should not be limited to just Mathematicians


However looking up some rules of logarithms by reading this page or looking on Wikipedia is not hard.

So quit moaning that 'such and such a library' does not have a function for logarithms of huge integers, and take five minutes to do a little addition and subtraction.

Often Ansi C coders first go searching for log() of huge integer functions, when they are writing prime number search programs, which is why I mention it.

Notes and Further Reading:

Laws of Logarithms is part of the "Core 2 (C2)" Curriculum for post compulsory education in the UK (A level) .

If you studied Engineering at University, then you will have encountered Laws of Logarithms twice - once as part of 'A Level' Mathematics, and once as part of your Engineering course.

All the Logarithms in this article are 'Natural Log'. Your calculator might show that as 'ln' depending on the brand.

The Laws of Logarithms apply similarly to base 10 logs - but you would obtain different decimal answers, than those tabulated above.

The Index page for that C2 book shows pages 43 and 44 cover 'multiplication law' & 'power law' for Logarithms.