• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Ratio of two real numbers

Joined
4/14/12
Messages
90
Points
18
This one is from WorldQuant. I got the solution, but not sure if it's correct. Hope someone can confirm it for me. Here's the problem:

Let a and b are two real numbers. What is the probability that leading digit of a/b is 1. Leading digit in 0.001980 is 1.

My approach: We see that there are only 4 cases for the leading digit of a/b to be 1. Due to symmetry, we only need to calculate the sum of the probability of 2 of these 4 cases: when 0<a<b and when b<a<2b for b>0. We then multiple this sum by 2 to get the final answer.

Now, when 0<a<b, the probability that the leading digit of a/b is 1: 1/8*(1/10+1/10^2+1/10^3+...)=1/7 (1/8= probability that 0<a<b occurs)

When b<a<2b for b>0, the probability that the leading digit of a/b is 1= 1/16 (=probability that b<a<2b for b>0).

Therefore, the probability that the leading digit of a/b is 1 is: 2*(1/72+1/16)=11/72.
 
Is the domain of a and b really the entire reals? What probability distribution generates them? (I dont think a uniform distribution over the reals is defined).
 
Is the domain of a and b really the entire reals? What probability distribution generates them? (I dont think a uniform distribution over the reals is defined).

Well, since the problem doesn't say anything, I assumed the domain is the entire real. Btw, my interpretation is that (a,b) are coordinates of the xy-plane, so that's why I got the probability of 0<a<b as 1/8.
 
Divide this into two cases with - 1. a>b, and 2. a<b with prob 1/2 each
Case 1 -> the leading digit is symmetric, so 1/9 prob of 1.
Case 2 -> same as b and a reversed with Case 1 being 5,6,7,8,9, so 5/9

1/9 * 1/2 + 5/9 * 1/2 = 1/3?
 
It's enough to treat the case \(a,b>0\). You need \(1\leq \frac{a}{b} \cdot 10^k <2\) for some integer \(k\), i.e., \(10^{-k} < \frac{a}{b} < 2\cdot 10^{-k}\). The region in the plane described by these inequalities is a windmill pattern of sectors in the first quadrant. The angles of these sectors are \(\tan^{-1}2\cdot 10^{-k}-\tan^{-1}10^{-k} = \tan^{-1}\frac{10^{-k}}{1+2\cdot 10^{-2k}}=\tan^{-1}\frac{10^k}{10^{2k}+2}\). The desired probability is then \(\frac{2}{\pi}\cdot \sum_{-\infty}^\infty \tan^{-1}\frac{10^k}{10^{2k}+2}\approx 0.3\).
 
It's enough to treat the \(a,b>0\).

How do you know if this is sufficient? And also, where does the (\frac{2}{\pi}) come from? For example, a may be 1, b is -10 and a/b=-0.1, which still has the leading digit of 1.
 
How do you know if this is sufficient? And also, where does the (\frac{2}{\pi}) come from? For example, a may be 1, b is -10 and a/b=-0.1, which still has the leading digit of 1.

Because sign does not matter. The proportion of the first quadrant where the condition is fulfilled will therefore be the same as the proportion of the entire plane where the condition is fulfilled. It's \(\frac{2}{\pi}\) because we're dividing the total angle where the condition happens by the full angle, \(\frac{\pi}{2}\).
 
Because sign does not matter. The proportion of the first quadrant where the condition is fulfilled will therefore be the same as the proportion of the entire plane where the condition is fulfilled. It's \(\frac{2}{\pi}\) because we're dividing the total angle where the condition happens by the full angle, \(\frac{\pi}{2}\).

I got it now! Thanks a lot for your great explanation:)
 
Back
Top