```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Probability...Simple problem, need help getting started
Date: Wed, 1 Dec 2010 20:04:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 15
Message-ID: <id69nm\$4ki\$1@fred.mathworks.com>
References: <id64vp\$hba\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1291233846 4754 172.30.248.37 (1 Dec 2010 20:04:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 1 Dec 2010 20:04:06 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:691669

"Don " <don.jackson@coker.edu> wrote in message <id64vp\$hba\$1@fred.mathworks.com>...
> Ok so my problem is, assume that the barbershop is open from 9-5, or for 8 hours a day. Person A and Person B each stay 30 min during visit, never longer, never shorter.
> What is the probability that they run into one another?
> Sample space: is 9-5 (The time the shop is open.) But should be denoted in matlab as 0-8.
> The equation that satisfies the condition is -.5 < | x-y | < .5, which breaks down into two equations y < x +.5 and y > x - .5
> Two graphs, and and the strip in the middle is the probability that they run into one another. To find the probability we must find the area of the strip in the middle, which we can do by simple math. (.5)(base)(height) which is this example is (.5)(7.5)(7.5) = 28.125 * 2 = 56.25 (Times it by two because of the two triangles made by the equations)
> 64 (total area of the 8x8 graph)   - 56.25 = 7.75/64 = 12 percent probability.
> The math is easy for me to understand but programming throws me off.  If someone could give me a push in the right direction i'd appreciate it.
> Thanks :)
- - - - - - - - -
I don't agree with your sample space assumptions, Don.  You have stated that each person always stays 30 minutes, never more or less.  This restricts the placement of a 30-minute time interval to a span of 7.5 hours, so your total sample space for two people is 7.5 by 7.5.  Your outside triangles are correspondingly smaller at 7 by 7.  I get twelve and eight/ninths percent probability for your problem.

Of course this assumes that each person will certainly visit just once during the day at uniformly distributed times and that their times are mutually independent (all questionable assumptions in real life.)

Roger Stafford
```