Right-hand rule and Bayes' theorem: Difference between pages

From TCS Wiki
(Difference between pages)
Jump to navigation Jump to search
imported>Macdonald-ross
(+)
 
 
Line 1: Line 1:
[[File:Cartesian coordinate system handedness.svg|thumb|The left-handed orientation is shown on the left, and the right-handed on the right.]]
In [[probability theory]] and applications, '''Bayes' theorem''' shows the relation between a '''[[conditional probability]]''' and its reverse form. For example, the probability of a [[hypothesis]] given some observed pieces of evidence and the probability of that evidence given the hypothesis. This theorem is named after [[Thomas Bayes]] ({{IPA-en|ˈbeɪz|}} or "bays") and often called '''Bayes' law''' or '''Bayes' rule'''.
[[File:Manoderecha.svg|thumb|Prediction of direction of field (''B'') when the current ''I'' flows in the direction of the thumb]]
[[File:Right-hand grip rule.svg|thumb|The right-hand rule for motion produced with screw threads]]


The '''right-hand rule''' is a convention in [[vector]] math.  It helps you remember [[direction]] when vectors get [[vector math|cross multiplied]].
== Formula ==


:# Start by closing your right hand and stick out your pointer finger.
The equation used is:
:# Stick your [[thumb]] straight up like a your making the sign for a [[gun]].
:<math>P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}.</math>
:# If you point your "gun" straight ahead, stick out your middle finger so that it points left and all your fingers are at [[right angle|right angles]] to each other.


If you have two vectors that you want to cross multiply, you can figure out the direction of the vector that comes out by pointing your thumb in the direction of the first vector and your pointer in the direction of the second vector. Your middle finger will point the direction of the cross product.
Where:
* P(''A'') is the [[prior probability]] or [[marginal probability]] of ''A''. It is "prior" in the sense that it does not take into account any information about&nbsp;''B''.
* P(''A''|''B'') is the [[conditional probability]] of ''A'', given ''B''. It is also called the [[posterior probability]] because it is derived from or depends upon the specified value of&nbsp;''B''.
* P(''B''|''A'') is the conditional probability of ''B'' given ''A''. It is also called the [[Likelihood function|likelihood]].
* P(''B'') is the prior or marginal probability of ''B'', and acts as a [[normalizing constant]].


Remember that when you change the order that vectors get cross multiplied, the result goes in the opposite direction.  So it's important to make sure that you go in the order of <math>\vec{thumb} \times \vec{pointer} = \vec{middle}</math>.
== Example ==


==Variations==
A simple example is as follows: There is a 40% chance of it raining on Sunday. If it rains on Sunday, there is a 10% chance it will rain on Monday. If it didn't rain on Sunday, there's an 80% chance it will rain on Monday.
There is another rule called the right-hand grip rule (or corkscrew rule) that is used for [[magnetism|magnetic fields]] and things that [[rotation|rotate]].  
:# Start by putting your right hand out flat and point your thumb straight out so that it is at a [[right angle]] to your other [[fingers]].
:# Now curl your fingers into a [[fist]] and keep your [[thumb]] out (like a Thumbs Up).
:# Match how your fingers curl in to the way something is moving. The direction that your thumb is pointing is the direction of the vector we use to talk about it.


You can do this in reverse by starting your thumb in the direction of the vector and see how your fingers curl to see the direction of rotation. If you point your thumb in the direction of current in a wire, the magnetic field that comes up around it is in the direction of your curling fingers.
"Raining on Sunday" is event A, and "Raining on Monday" is event B.
* P(''A'') = 0.40 = Probability of Raining on Sunday.
* P(''A`'') = 0.60 = Probability of not raining on Sunday.
* P(''B|A'') = 0.10 = Probability of it raining on Monday, if it rained on Sunday.
* P(''B`|A'') = 0.90 = Probability of it not raining on Monday, if it rained on Sunday.
* P(''B|A`'') = 0.80 = Probability of it raining on Monday, if it did not rain on Sunday.
* P(''B`|A`'') = 0.20 = Probability of it not raining on Monday, if it did not rain on Sunday.


[[Category:Mathematics]]
The first thing we'd normally calculate is the probability of it raining on Monday:
This would be the sum of the probability of "Raining on Sunday and raining on Monday" and "Not raining on Sunday and raining on Monday"
:<math> 0.40\times0.10 + 0.60\times0.80 = 0.52 = 52%</math> chance
 
However, what if we said: "It rained on Monday. What is the probability it rained on Sunday?" That is where Bayes' theorem comes in. It allows us to calculate the probability of an earlier event, given the result of a later event.
 
The equation used is:
 
:<math>P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}.</math>
 
In our case, "Raining on Sunday" is event A, and "Raining on Monday" is event B.
* P(''B|A'') = 0.10 = Probability of it raining on Monday, if it rained on Sunday.
* P(''A'') = 0.40 = Probability of Raining on Sunday.
* P(''B'') = 0.52 = Probability of Raining on Monday.
 
So, to calculate the probability it rained on Sunday, given that it rained on Monday:
:<math>P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}.</math>
or:
:<math>P(A|B) = \frac{0.10*0.40}{0.52} = .0769</math>
In other words, if it rained on Monday, there's a 7.69% chance it rained on Sunday.
 
== Intuitive explanation ==
 
To calculate the probability of it having rained on Sunday, given that it rained on Monday, we can take the following steps:
* We know that it rained on Monday. Therefore, the total probability is P(B).
* The probability it rained on Sunday is P(A).
* The probability it rained on Monday, given that it rained on Sunday is P(B|A).
* The probability of raining on Sunday AND raining Monday is P(A)*P(B|A).
* Therefore, the total probability of it having rained on Sunday, given that it rained on Monday, is the chance of it raining on Sunday and Monday divided by the total chance of it having rained on Monday.
Therefore,
:<math>P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}.</math>


Another way to see this, which shows where Bayes' theorem comes from, is to consider the probability P(AB) that it rains on both Sunday and Monday.  This can be calculated in two different ways, which give the same answer for P(AB):
:<math>P(A)\, P(B|A) = P(B)\, P(A|B)</math>
Bayes' theorem is just another way to write that equation.


{{math-stub}}
[[Category:Mathematics]]

Latest revision as of 12:22, 15 November 2016

In probability theory and applications, Bayes' theorem shows the relation between a conditional probability and its reverse form. For example, the probability of a hypothesis given some observed pieces of evidence and the probability of that evidence given the hypothesis. This theorem is named after Thomas Bayes (Template:IPA-en or "bays") and often called Bayes' law or Bayes' rule.

Formula

The equation used is:

[math]\displaystyle{ P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}. }[/math]

Where:

Example

A simple example is as follows: There is a 40% chance of it raining on Sunday. If it rains on Sunday, there is a 10% chance it will rain on Monday. If it didn't rain on Sunday, there's an 80% chance it will rain on Monday.

"Raining on Sunday" is event A, and "Raining on Monday" is event B.

  • P(A) = 0.40 = Probability of Raining on Sunday.
  • P(A`) = 0.60 = Probability of not raining on Sunday.
  • P(B|A) = 0.10 = Probability of it raining on Monday, if it rained on Sunday.
  • P(B`|A) = 0.90 = Probability of it not raining on Monday, if it rained on Sunday.
  • P(B|A`) = 0.80 = Probability of it raining on Monday, if it did not rain on Sunday.
  • P(B`|A`) = 0.20 = Probability of it not raining on Monday, if it did not rain on Sunday.

The first thing we'd normally calculate is the probability of it raining on Monday: This would be the sum of the probability of "Raining on Sunday and raining on Monday" and "Not raining on Sunday and raining on Monday"

[math]\displaystyle{ 0.40\times0.10 + 0.60\times0.80 = 0.52 = 52% }[/math] chance

However, what if we said: "It rained on Monday. What is the probability it rained on Sunday?" That is where Bayes' theorem comes in. It allows us to calculate the probability of an earlier event, given the result of a later event.

The equation used is:

[math]\displaystyle{ P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}. }[/math]

In our case, "Raining on Sunday" is event A, and "Raining on Monday" is event B.

  • P(B|A) = 0.10 = Probability of it raining on Monday, if it rained on Sunday.
  • P(A) = 0.40 = Probability of Raining on Sunday.
  • P(B) = 0.52 = Probability of Raining on Monday.

So, to calculate the probability it rained on Sunday, given that it rained on Monday:

[math]\displaystyle{ P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}. }[/math]

or:

[math]\displaystyle{ P(A|B) = \frac{0.10*0.40}{0.52} = .0769 }[/math]

In other words, if it rained on Monday, there's a 7.69% chance it rained on Sunday.

Intuitive explanation

To calculate the probability of it having rained on Sunday, given that it rained on Monday, we can take the following steps:

  • We know that it rained on Monday. Therefore, the total probability is P(B).
  • The probability it rained on Sunday is P(A).
  • The probability it rained on Monday, given that it rained on Sunday is P(B|A).
  • The probability of raining on Sunday AND raining Monday is P(A)*P(B|A).
  • Therefore, the total probability of it having rained on Sunday, given that it rained on Monday, is the chance of it raining on Sunday and Monday divided by the total chance of it having rained on Monday.

Therefore,

[math]\displaystyle{ P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}. }[/math]

Another way to see this, which shows where Bayes' theorem comes from, is to consider the probability P(AB) that it rains on both Sunday and Monday. This can be calculated in two different ways, which give the same answer for P(AB):

[math]\displaystyle{ P(A)\, P(B|A) = P(B)\, P(A|B) }[/math]

Bayes' theorem is just another way to write that equation.