1import{j as e,B as re,S as pe}from"./index-DxzsxK2X.js";import{r as j,L as $}from"./vendor-DlcqtHFq.js";import{M as ue}from"./MarketingLayout-BqcyWV3e.js";import{C as fe}from"./circle-check-ChkjSNco.js";import{C as ge}from"./circle-x-BdP0D6z-.js";import{R as je}from"./rotate-ccw-DjIsYZ50.js";import{u as ye,A as Ne,M as ve}from"./useScrollSpy-5czGbz9L.js";import{a as we,b as Pe,f as Be,q as Ae}from"./schemas-LlmsxjhX.js";import{C as ne}from"./chevron-right-CeoH38AI.js";import{L as l}from"./link-ClbJ78HG.js";import{B as Te}from"./book-open-CsF8txL6.js";import{L as T}from"./lightbulb-BY8cMslo.js";const c=[{id:1,question:"P(A|B) represents:",options:["P(A and B)","P(A given B occurred)","P(A or B)","P(A) - P(B)"],correctIndex:1,explanation:"P(A|B) is read as 'probability of A given B has occurred'."},{id:2,question:"Formula for conditional probability:",options:["P(A and B) / P(B)","P(A) Ã P(B)","P(A) + P(B)","P(A) / P(B)"],correctIndex:0,explanation:"P(A|B) = P(A â© B) / P(B)."},{id:3,question:"Two events are independent if:",options:["P(A|B) = P(A)","P(A and B) = 0","P(A) = P(B)","P(A or B) = P(A) Ã P(B)"],correctIndex:0,explanation:"Independent events: knowing B occurred doesn't change the probability of A."},{id:4,question:"Bayes' theorem relates:",options:["P(A and B)","P(A|B) and P(B|A)","P(A) + P(B)","P(A) Ã P(B)"],correctIndex:1,explanation:"Bayes' theorem: P(A|B) = P(B|A) Ã P(A) / P(B). It allows us to 'reverse' conditional probabilities."},{id:5,question:"P(A and B) = P(A) Ã P(B) for:",options:["Dependent events","Independent events","Mutually exclusive events","Impossible events"],correctIndex:1,explanation:"The simple multiplication rule P(A and B) = P(A) Ã P(B) only applies to independent events."},{id:6,question:"Drawing cards without replacement creates:",options:["Independent events","Dependent events","Impossible events","Certain events"],correctIndex:1,explanation:"Without replacement, the outcome of the first draw affects the probabilities for the second draw."},{id:7,question:"In a two-way table, P(row | column) =",options:["cell / total","cell / row total","cell / column total","row / column"],correctIndex:2,explanation:"To find a conditional probability given a column, divide the cell count by the column total."},{id:8,question:"P(B|A) Ã P(A) equals:",options:["P(A or B)","P(A and B)","P(A|B)","P(B)"],correctIndex:1,explanation:"General multiplication rule: P(A and B) = P(B|A) Ã P(A)."},{id:9,question:"Medical test example: sensitivity is:",options:["P(Positive | No Disease)","P(Positive | Disease)","P(Disease | Positive)","P(No Disease)"],correctIndex:1,explanation:"Sensitivity is the probability of a positive test result given the person has the disease."},{id:10,question:"If P(A) = 0.3, P(B) = 0.4, P(A and B) = 0.1, find P(A|B)",options:["0.1","0.25","0.3","0.4"],correctIndex:1,explanation:"P(A|B) = P(A and B) / P(B) = 0.1 / 0.4 = 0.25."}];function ke({headless:v=!1}={}){const[i,w]=j.useState({}),[s,P]=j.useState(!1),m=s?c.filter(r=>i[r.id]===r.correctIndex).length:0,Y=(r,a)=>{s||w(x=>({...x,[r]:a}))},B=()=>{Object.keys(i).length<c.length||P(!0)},A=()=>{w({}),P(!1)},b=Object.keys(i).length===c.length;return e.jsxs("div",{children:[!v&&e.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Practice Quiz"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Test your understanding â select the correct answer for each question."}),s&&e.jsxs("div",{className:`mb-8 rounded-xl p-5 text-center ${m===c.length?"bg-green-50 border border-green-200":m>=c.length*.7?"bg-blue-50 border border-blue-200":"bg-amber-50 border border-amber-200"}`,children:[e.jsxs("p",{className:"text-2xl font-bold mb-1",children:[m," / ",c.length]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:m===c.length?"Perfect score! You nailed it.":m>=c.length*.7?"Great job! Review the ones you missed.":"Keep studying â review the explanations below."})]}),e.jsx("div",{className:"space-y-8",children:c.map((r,a)=>{const x=i[r.id],p=s&&x===r.correctIndex,q=s&&x!==void 0&&x!==r.correctIndex;return e.jsxs("div",{className:`rounded-xl border p-5 transition-colors ${p?"border-green-300 bg-green-50/50":q?"border-red-300 bg-red-50/50":"border-border"}`,children:[e.jsxs("p",{className:"font-semibold mb-3",children:[e.jsxs("span",{className:"text-muted-foreground mr-2",children:[a+1,"."]}
1),r.question]}),e.jsx("div",{className:"space-y-2",children:r.options.map((y,o)=>{const k=x===o,n=s&&o===r.correctIndex,t=s&&k&&o!==r.correctIndex;let d="border-border hover:border-primary/40";return k&&!s&&(d="border-primary bg-primary/5"),n&&(d="border-green-400 bg-green-50"),t&&(d="border-red-400 bg-red-50"),e.jsxs("button",{type:"button",onClick:()=>Y(r.id,o),disabled:s,className:`w-full text-left rounded-lg border px-4 py-3 text-sm transition-all flex items-center gap-3 ${d} ${s?"cursor-default":"cursor-pointer"}`,children:[e.jsx("span",{className:`flex-shrink-0 w-6 h-6 rounded-full border-2 flex items-center justify-center text-xs font-bold ${k&&!s?"border-primary bg-primary text-white":n?"border-green-500 bg-green-500 text-white":t?"border-red-500 bg-red-500 text-white":"border-gray-300"}`,children:String.fromCharCode(65+o)}),e.jsx("span",{className:"flex-1",children:y}),n&&e.jsx(fe,{className:"h-5 w-5 text-green-600 flex-shrink-0"}),t&&e.jsx(ge,{className:"h-5 w-5 text-red-500 flex-shrink-0"})]},o)})}),s&&e.jsxs("div",{className:"mt-3 rounded-lg bg-muted/40 p-3 text-sm text-muted-foreground",children:[e.jsx("strong",{children:"Explanation:"})," ",r.explanation]})]},r.id)})}),e.jsx("div",{className:"mt-8 flex gap-3",children:s?e.jsxs(re,{onClick:A,variant:"outline",className:"gap-2",children:[e.jsx(je,{className:"h-4 w-4"}),"Retake Quiz"]}):e.jsxs(re,{onClick:B,disabled:!b,className:"bg-primary text-white hover:bg-primary/90",children:["Submit Answers (",Object.keys(i).length,"/",c.length,")"]})})]})}function Ie(){const v=j.useRef(null),[i,w]=j.useState(.01),[s,P]=j.useState(.95),[m,Y]=j.useState(.95),B=1-m,A=1e3,b=Math.round(A*i),r=A-b,a=Math.round(b*s),x=b-a,p=Math.round(r*B),q=r-p,y=a+p,o=y>0?a/y:0;j.useEffect(()=>{const n=v.current;if(!n)return;const t=n.getContext("2d");if(!t)return;const d=window.devicePixelRatio||1,O=()=>{const u=n.getBoundingClientRect();n.width=u.width*d,n.height=u.height*d,t.setTransform(d,0,0,d,0,0)};O();const J=()=>{const u=n.width/d,K=n.height/d;t.clearRect(0,0,u,K);const V=16,Z=36,ae=24,R=u-V*2,I=K-Z-ae,f=V,h=Z;t.fillStyle="#334155",t.font="bold 13px system-ui, sans-serif",t.textAlign="center",t.fillText("Population Treemap (per 1,000 people)",u/2,20);const oe=Math.max(i,.015),N=R*oe,Q=R-N,le=s,de=B,S=I*le,X=I-S,C=I*de,ee=I-C,E=(W,F,D,g,xe,he,se,_,be)=>{if(t.fillStyle=xe,t.fillRect(W,F,D,g),be&&(t.strokeStyle="#f59e0b",t.lineWidth=3,t.setLineDash([6,3]),t.strokeRect(W+1.5,F+1.5,D-3,g-3),t.setLineDash([])),t.strokeStyle=he,t.lineWidth=1.5,t.strokeRect(W,F,D,g),D>30&&g>24){t.fillStyle="#1e293b",t.textAlign="center";const M=W+D/2,z=F+g/2;g>50?(t.font="bold 12px system-ui, sans-serif",t.fillText(se,M,z-10),t.font="bold 16px system-ui, sans-serif",t.fillText(String(_),M,z+10),g>70&&(t.font="10px system-ui, sans-serif",t.fillStyle="#475569",t.fillText(`(${(_/A*100).toFixed(1)}%)`,M,z+26))):g>30?(t.font="bold 10px system-ui, sans-serif",t.fillText(`${se}: ${_}`,M,z+4)):(t.font="bold 9px system-ui, sans-serif",t.fillText(`${_}`,M,z+3))}};E(f,h,N,S,"rgba(239, 68, 68, 0.35)","rgba(239, 68, 68, 0.6)","True Pos",a,!0),E(f,h+S,N,X,"rgba(252, 165, 165, 0.35)","rgba(252, 165, 165, 0.6)","False Neg",x,!1),E(f+N,h,Q,C,"rgba(251, 191, 36, 0.35)","rgba(251, 191, 36, 0.6)","False Pos",p,!0),E(f+N,h+C,Q,ee,"rgba(34, 197, 94, 0.25)","rgba(34, 197, 94, 0.5)","True Neg",q,!1),t.fillStyle="#dc2626",t.font="bold 11px system-ui, sans-serif",t.textAlign="center",t.fillText(`Disease (${b})`,f+N/2,h-6),t.fillStyle="#16a34a",t.fillText(`No Disease (${r})`,f+N+Q/2,h-6),t.save(),t.fillStyle="#64748b",t.font="10px system-ui, sans-serif",t.textAlign="left";const ce=h+Math.min(S,C)/2;t.fillText("Test +",f+R+4,ce+3);const me=h+Math.max(S,C)+Math.min(X,ee)/2;t.fillText("Test -",f+R+4,me+3),t.restore(),t.fillStyle="#92400e",t.font="bold 11px system-ui, sans-serif",t.textAlign="center";const te=h+I+16;y>0?t.fillText(`P(Disease | Positive) = ${a} / (${a} + ${p}) = ${(o*100).toFixed(1)}%`,u/2,te):t.fillText("No positive test results",u/2,te)};J();const U=()=>{O(),J()};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[i,s,m,B,a,x,p,q,y,o,b,r]);const k=o>=.5?"#dc2626":o>=.2?"#f59e0b":"#16a34a";return e.jsxs("div",{className:"rounded-xl border border-blue-200/60 bg-gradient-to-br from-blue-50/80 via-white to-indigo-50/60 p-6 mb-6 overflow-hidden",children:[e.jsx("h3",{className:"text-lg font-semibold mb-1 text-foreground",children:"Interactive: Bayes' Theorem Calculator"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-5",children:"Adjust disease prevalence, test sensitivity, and specificity to see how Bayes' theorem determines the true probability of disease given a positive test."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-5 items-stretch",children:[e.jsxs("div",{className:"flex-shrink-0 sm:w-56 space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"P(Disease)"}),e.jsxs("span",{className:"text-sm font-bold text-foreground tabular-nums",children:[(i*100).toFixed(1),"%"]})]}
1),e.jsx("input",{type:"range",min:.001,max:.5,step:.001,value:i,onChange:n=>w(Number(n.target.value)),className:`w-full h-2 rounded-full appearance-none cursor-pointer bg-blue-100 2 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5 3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-red-500 [&::-webkit-slider-thumb]:shadow-md 4 [&::-webkit-slider-thumb]:hover:bg-red-600 [&::-webkit-slider-thumb]:transition-colors 5 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:rounded-full 6 [&::-moz-range-thumb]:bg-red-500 [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:shadow-md`}),e.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-0.5",children:[e.jsx("span",{children:"Rare"}),e.jsx("span",{children:"Common"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("label",{className:"text-sm font-medium text-foreground",children:"Sensitivity P(+|D)"}),e.jsxs("span",{className:"text-sm font-bold text-foreground tabular-nums",children:[(s*100).toFixed(0),"%"]})]}),e.jsx("input",{type:"range",min:.5,max:1,step:.01,value:s,onChange:n=>P(Number(n.target.value)),className:`w-full h-2 rounded-full appearance-none cursor-pointer bg-blue-100 7 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5 8 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-blue-500 [&::-webkit-slider-thumb]:shadow-md 9 [&::-webkit-slider-thumb]:hover:bg-blue-600 [&::-webkit-slider-thumb]:transition-colors 10 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:rounded-full 11 [&::-moz-range-thumb]:bg-blue-500 [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:shadow-md`}),e.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-0.5",children:[e.jsx("span",{children:"50%"}),e.jsx("span",{children:"100%"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Specificity P(-|","¬","D)"]}),e.jsxs("span",{className:"text-sm font-bold text-foreground tabular-nums",children:[(m*100).toFixed(0),"%"]})]}),e.jsx("input",{type:"range",min:.5,max:1,step:.01,value:m,onChange:n=>Y(Number(n.target.value)),className:`w-full h-2 rounded-full appearance-none cursor-pointer bg-blue-100 12 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-5 13 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#22c55e] [&::-webkit-slider-thumb]:shadow-md 14 [&::-webkit-slider-thumb]:hover:bg-[#16a34a] [&::-webkit-slider-thumb]:transition-colors 15 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:rounded-full 16 [&::-moz-range-thumb]:bg-[#22c55e] [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:shadow-md`}),e.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-0.5",children:[e.jsx("span",{children:"50%"}),e.jsx("span",{children:"100%"})]})]}),e.jsxs("div",{className:"rounded-lg bg-white/70 border border-blue-100 px-3 py-2.5 space-y-1.5",children:[e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"P(Disease)"}),e.jsxs("span",{className:"font-bold text-red-600",children:[(i*100).toFixed(1),"%"]})]}),e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Sensitivity"}),e.jsxs("span",{className:"font-bold text-blue-600",children:[(s*100).toFixed(0),"%"]})]}),e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"False Pos Rate"}),e.jsxs("span",{className:"font-bold text-amber-600",children:[(B*100).toFixed(0),"%"]})]}),e.jsx("hr",{className:"border-blue-100"}),e.jsxs("div",{className:"text-center py-1",children:[e.jsx("p",{className:"text-[10px] text-muted-foreground uppercase tracking-wider font-semibold mb-0.5",children:"P(Disease | Positive)"}),e.jsxs("p",{className:"text-2xl font-bold tabular-nums",style:{color:k},children:[(o*100).toFixed(1),"%"]})]}),e.jsx("hr",{className:"border-blue-100"}),e.jsxs("div",{className:"text-[10px] text-muted-foreground space-y-0.5",children:[e.jsxs("p",{className:"font-semibold text-foreground",children:["Out of ",A.toLocaleStr
16ing()," people:"]}),e.jsxs("p",{children:[b," have disease, ",a," test + ",e.jsx("span",{className:"text-red-600",children:"(true pos)"})]}),e.jsxs("p",{children:[r," are healthy, ",p," test + ",e.jsx("span",{className:"text-amber-600",children:"(false pos)"})]}),e.jsxs("p",{className:"font-semibold text-foreground mt-1",children:[a," of ",y," positives actually have disease"]})]})]})]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"aspect-square sm:aspect-[4/3] rounded-xl bg-white/60 border border-blue-100 overflow-hidden",children:e.jsx("canvas",{ref:v,className:"w-full h-full"})})})]})]})}const H="https://www.tutoremy.ai",G=`${H}/resources/mathematics/conditional-probability`,ie=[{question:"What's the difference between P(A and B) and P(A|B)?",answer:"P(A and B) is the probability that both A and B happen within the entire original sample space. P(A|B) is the probability that A happens given that B has already happened, effectively reducing your sample space to only those outcomes where B is true. Think of P(A and B) as a slice of the whole pie, and P(A|B) as a slice of just the B-portion of the pie."},{question:"Can events be both mutually exclusive and independent?",answer:"Generally, no (unless one of the events has a probability of 0). If two events A and B are mutually exclusive, then P(A and B) = 0. If they were also independent, then P(A and B) = P(A) Ã P(B), which would require P(A) or P(B) to be 0. So if both events have non-zero probability, they cannot be both mutually exclusive and independent. In fact, mutually exclusive events are highly dependent â knowing one happened tells you the other definitely did not."},{question:"When should I use a tree diagram versus a two-way table?",answer:"Tree diagrams are best for sequential events where the outcome of one event influences the probabilities of subsequent events (dependent events). They clearly show the multiplication rule along each path. Two-way tables (contingency tables) are ideal for two categorical variables where you want to analyze their relationship and calculate conditional probabilities from observed frequencies or counts."},{question:"Why is Bayes' Theorem important?",answer:"Bayes' Theorem allows us to update our beliefs (prior probabilities) with new evidence to get a more accurate, updated probability (posterior probability). It is essential in fields like medical diagnosis (reversing P(Test+|Disease) to find P(Disease|Test+)), spam filtering, and artificial intelligence, where you need to assess the likelihood of a cause given an observed effect."},{question:"How do I know if two events are independent?",answer:"You can test for independence using any of these conditions: (1) P(A|B) = P(A), (2) P(B|A) = P(B), or (3) P(A and B) = P(A) Ã P(B). If any one of these is true, the events are independent. If none hold, they are dependent. Do not assume independence unless it is given or you have proven it with data."}],L=[{id:"introduction",label:"1. Introduction"},{id:"key-definitions",label:"2. Key Definitions"},{id:"conditional-probability-formula",label:"3. Conditional Probability Formula"},{id:"independent-vs-dependent",label:"4. Independent vs Dependent Events"},{id:"multiplication-rule",label:"5. The Multiplication Rule"},{id:"bayes-theorem",label:"6. Bayes' Theorem"},{id:"tables-and-diagrams",label:"7. Two-Way Tables & Tree Diagrams"},{id:"memory-aids",label:"8. Memory Aids"},{id:"common-mistakes",label:"9. Common Mistakes"},{id:"revision-summary",label:"Quick Revision"},{id:"faq",label:"FAQ"},{id:"quiz",label:"Practice Quiz"}];function Le(){const v=j.useMemo(()=>L.map(s=>s.id),[]),i=ye(v),w=[we({title:"Conditional Probability: Formulas, Bayes' Theorem & Practice â Complete Guide",description:"Master conditional probability â P(A|B), Bayes' Theorem, independent and dependent events, two-way tables, and tree diagrams. Includes worked examples, memory aids, and practice quiz.",url:G,datePublished:"2026-03-03T00:00:00Z",dateModified:"2026-03-03T00:00:00Z",teaches:["Conditional Probability","Bayes Theorem","Independent Events","Dependent Events","Two-Way Tables","Multiplication Rule"]}),Pe([{name:"Resources",url:`${H}/resources`},{name:"Mathematics",url:`${H}/resources/mathematics`},{name:"Conditional Probability",url:G}]),Be(ie),Ae({title:"Conditional Probability Practice Quiz",description:"Test your understanding of conditional probability, Bayes' Theorem, independent and dependent events",questions:c})];return e.jsxs(ue,{children:[e.jsx(pe,{title:"Conditional Probability: Formulas, Bayes' Theorem & Practice â Complete Guide",description:"Master conditional probability â P(A|B), Bayes' Theorem, independent and dependent events, two-way tables, and tree diagrams. Includes worked examples, memory aids, and practice quiz.",canonicalUrl:G,ogType:"article",articlePublishedTime:"2026-03-03T00:00:00Z",articleModifiedTime:"2026-03-03T00:00:00Z",jsonLd:w}),e.jsx("div",{className:"border-b bg-muted/40",children:e.jsxs("div",{className:"container flex flex-wrap items-center gap-1.5 py-3 text-sm text-muted-foreground",children:[e.jsx($,{to:"/resources",className:"hover:text-foreground transition-colors",children:"Resources"}),e.jsx(ne,{className:"h-3.5 w-3.5"}),e.jsx($,{to:"/resources/mathematics",className:"hover:text-foreground transition-colors",children:"Mathematics"}),e.jsx(ne,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"text-foreground font-medium",children:"Conditional Probability"})]})}),e.jsx("article",{className:"container py-12 lg:py-16",children:e.jsxs("div",{className:"mx-auto max-w-3xl lg:max-w-5xl lg:flex lg:gap-12",children:[e.jsx(Ne,{sections:[...L],activeId:i}),e.jsx(ve,{sections:[...L],activeId:i}),e.jsxs("div",{className:"min-w-0 max-w-3xl flex-1",children:[e.jsxs("header",{className:"mb-12",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("span",{className:"rounded-full bg-primary/10 px-3 py-1 text-xs font-semibold text-primary",children:"Mathematics"}),e.jsx("span",{className:"rounded-full bg-muted px-3 py-1 text-xs font-medium text-muted-foreground",children:"High School"})]}),e.jsx("h1",{className:"text-4xl font-bold mb-4 sm:text-5xl",children:"Conditional Probability"}),e.jsxs("p",{className:"text-lg text-muted-foreground mb-4",children:[e.jsx("strong",{children:"Conditional probability"})," is the probability of an event occurring given that another event has already occurred. It is a cornerstone of statistics that helps us update our beliefs and make better predictions when new information becomes available."]}),e.jsx("p",{className:"text-lg text-muted-foreground",children:"This guide covers the conditional probability formula, independent vs dependent events, the multiplication rule, Bayes' Theorem, two-way tables, tree diagrams, worked examples, memory aids, and a practice quiz."})]}),e.jsxs("nav",{className:"mb-12 rounded-xl border border-border bg-muted/30 p-6 lg:hidden",children:[e.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"In this guide"}),e.jsx("ol",{className:"space-y-1.5 text-sm",children:L.map(s=>e.jsx("li",{children:e.jsx("a",{href:`#${s.id}`,className:"text-primary hover:underline",children:s.label})},s.id))})]}),e.jsxs("section",{id:"introduction",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#introduction",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-white text-sm font-bold",children:"1"}),"Introduction",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsx("p",{className:"text-muted-foreground mb-3",children:"Imagine you're trying to predict if it will rain tomorrow. If you know nothing else, the probability might be around 30%. But what if you wake up and see dark clouds gathering and hear a
16weather report predicting a storm? Suddenly, the probability of rain feels much higher."}),e.jsxs("p",{className:"text-muted-foreground mb-4",children:["This is the essence of ",e.jsx("strong",{children:"conditional probability"}),": it is the probability of an event occurring ",e.jsx("em",{children:"given that another event has already occurred or is known to be true"}),". It is about updating our beliefs and probabilities with new, relevant information."]}),e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10 p-5 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Te,{className:"h-4 w-4 text-primary flex-shrink-0"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-primary",children:"Picture This"})]}),e.jsx("p",{className:"text-lg italic font-serif text-foreground leading-relaxed",children:"You're a detective investigating a crime. You initially think there's a 10% chance the suspect is guilty. Then, new evidence emerges: the suspect's fingerprints are found at the scene. Suddenly, your belief in their guilt skyrockets! The probability of guilt given the fingerprint evidence is much higher than the initial probability alone. Conditional probability is your statistical magnifying glass, focusing on the relevant facts."})]}),e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Why It Matters"}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Medical Tests"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"How likely is it that you actually have a disease given that your test result was positive?"})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Weather Forecasting"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"What is the chance of snow given the temperature drops below freezing?"})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Business Decisions"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"What is the probability a customer will buy a product given they clicked on an ad?"})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Sports Analytics"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"What is the chance a team wins given they are leading at halftime?"})]})]})]}),e.jsxs("section",{id:"key-definitions",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#key-definitions",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-white text-sm font-bold",children:"2"}),"Key Definitions",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Conditional Probability"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'The probability of an event A occurring given that another event B has already occurred. Written as P(A|B) and read "the probability of A given B."'})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Independent Events"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Two events where the occurrence of one does not affect the probability of the other. If A and B are independent, then P(A|B) = P(A)."})]})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Dependent Events"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Two events where the occurrence of one does affect the probability of the other. If A and B are dependent, then P(A|B) â P(A)."})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Mutually Exclusive Events"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Two events that cannot both occur at the same time. If A and B are mutually exclusive, then P(A and B) = 0."})]})]}),e.jsxs("div",{className:"grid sm:grid-cols-3 gap-3 mb-4",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Bayes' Theorem"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"A formula that describes how to update the probability of a hypothesis based on new evidence. It relates P(A|B) to P(B|A)."})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Prior Probability"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Your initial belief or probability of an event before any new evidence is considered, e.g. P(A) in Bayes' Theorem."})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Posterior Probability"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"The updated probability of an event after considering new evidence, e.g. P(A|B) in Bayes' Theorem."})]})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Tree Diagram"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"A visual tool used to map out sequential events and their probabilities, especially useful for conditional probabilities."})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Two-Way Table"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"A table that displays the frequencies of two categorical variables, often used to calculate conditional probabilities from observed data."})]})]})]}),e.jsxs("section",{id:"conditional-probability-formula",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#conditional-probability-formula",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-white text-sm font-bold",children:"3"}),"Conditional Probability Formula",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsxs("p",{className:"text-muted-foreground mb-4",children:["The core idea of conditional probability is that knowing event B has happened ",e.jsx("strong",{children:"reduces our sample space"})," to only those outcomes where B is true. Then, we look for event A within that reduced sample space."]}),e.jsxs("div",{className:"rounded-xl bg-gradient-to-r from-primary/5 to-primary/10 border border-primary/20 p-6 mb-6 text-center",children:[e.jsx("p",{className:"text-3xl font-bold font-mono text-foreground mb-3",children:"P(A|B) = P(A â© B) / P(B)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"The probability of A given B equals the probability of both A and B occurring, divided by the probability of B. P(B) cannot be zero."})]}),e.jsx("div",{className:"mb-6",children:e.jsx("img",{src:"/resources/conditional-probability/image_1_conditional_formula.png",alt:"
16Venn diagram showing conditional probability formula P(A|B) = P(A and B) / P(B) with the sample space reduced to event B",className:"w-full rounded-xl border border-border",loading:"lazy"})}),e.jsx("p",{className:"text-muted-foreground mb-4",children:'Think of it this way: out of all the times B happens, how often does A also happen? The vertical line "|" in P(A|B) literally means "given that."'}),e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Worked Example: Drawing Balls"}),e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-5 mb-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"A bag contains 5 red balls and 3 blue balls. You draw one ball and it is red. What is the probability that the next ball (drawn without replacement) is also red?"}),e.jsxs("div",{className:"rounded-lg bg-muted/60 p-3 font-mono text-sm space-y-1",children:[e.jsx("p",{children:"Initial: 8 balls (5 red, 3 blue)"}),e.jsx("p",{children:"After first red drawn: 7 balls left (4 red, 3 blue)"}),e.jsx("p",{children:"P(2nd red | 1st red) = 4 / 7"}),e.jsx("p",{className:"font-bold text-primary",children:"Answer: 4/7"})]})]}),e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Worked Example: Using the Formula"}),e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-5",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"If P(A) = 0.4, P(B) = 0.5, and P(A and B) = 0.2, find P(A|B)."}),e.jsxs("div",{className:"rounded-lg bg-muted/60 p-3 font-mono text-sm space-y-1",children:[e.jsx("p",{children:"P(A|B) = P(A and B) / P(B)"}),e.jsx("p",{children:"P(A|B) = 0.2 / 0.5"}),e.jsx("p",{className:"font-bold text-primary",children:"P(A|B) = 0.4"})]})]})]}),e.jsxs("section",{id:"independent-vs-dependent",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#independent-vs-dependent",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-white text-sm font-bold",children:"4"}),"Independent vs Dependent Events",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Understanding the difference between independent and dependent events is crucial for applying the correct probability rules."}),e.jsx("div",{className:"mb-6",children:e.jsx("img",{src:"/resources/conditional-probability/image_4_independent_vs_dependent.png",alt:"Side-by-side Venn diagrams comparing independent events (where P(A|B) = P(A)) and dependent events (where P(A|B) differs from P(A))",className:"w-full rounded-xl border border-border",loading:"lazy"})}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 mb-6",children:[e.jsxs("div",{className:"rounded-xl border border-green-200 bg-green-50/50 p-5",children:[e.jsx("p",{className:"font-semibold text-green-800 mb-2",children:"Independent Events"}),e.jsxs("p",{className:"text-sm text-green-700 mb-2",children:["The occurrence of one does ",e.jsx("strong",{children:"not"})," influence the probability of the other."]}),e.jsx("div",{className:"rounded-lg bg-white/60 p-3 font-mono text-sm",children:e.jsx("p",{className:"font-bold text-green-700",children:"Test: P(A|B) = P(A)"})}),e.jsx("p",{className:"text-xs text-green-600 mt-2",children:"Example: Flipping a coin twice. The outcome of the first flip does not affect the second."})]}),e.jsxs("div",{className:"rounded-xl border border-blue-200 bg-blue-50/50 p-5",children:[e.jsx("p",{className:"font-semibold text-blue-800 mb-2",children:"Dependent Events"}),e.jsxs("p",{className:"text-sm text-blue-700 mb-2",children:["The occurrence of one ",e.jsx("strong",{children:"does"})," affect the probability of the other."]}),e.jsx("div",{className:"rounded-lg bg-white/60 p-3 font-mono text-sm",children:e.jsx("p",{className:"font-bold text-blue-700",children:"Test: P(A|B) â P(A)"})}),e.jsx("p",{className:"text-xs text-blue-600 mt-2",children:"Example: Drawing cards without replacement. The probability of the second draw depends on the first."})]})]}),e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Worked Example: Testing for Independence"}),e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-5",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:'A survey of 200 students found: 60 boys like Math, 30 boys like English, 40 girls like Math, 70 girls like English. Are "being a Boy" and "liking Math" independent?'}),e.jsxs("div",{className:"rounded-lg bg-muted/60 p-3 font-mono text-sm space-y-1",children:[e.jsx("p",{children:"P(Math | Boy) = 60 / 90 = 2/3"}),e.jsx("p",{children:"P(Math) = 100 / 200 = 1/2"}),e.jsx("p",{children:"2/3 â 1/2"}),e.jsx("p",{className:"font-bold text-primary",children:"The events are dependent."})]})]})]}),e.jsxs("section",{id:"multiplication-rule",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#multiplication-rule",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-white text-sm font-bold",children:"5"}),"The Multiplication Rule",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsxs("p",{className:"text-muted-foreground mb-4",children:["The general multiplication rule applies to ",e.jsx("strong",{children:"any"})," two events, whether they are independent or dependent. It is a rearrangement of the conditional probability formula."]}),e.jsxs("div",{className:"rounded-xl bg-gradient-to-r from-primary/5 to-primary/10 border border-primary/20 p-6 mb-6 text-center",children:[e.jsx("p",{className:"text-2xl font-bold font-mono text-foreground mb-2",children:"P(A and B) = P(A|B) Ã P(B)"}),e.jsx("p",{className:"text-lg font-bold font-mono text-foreground mb-3",children:"P(A and B) = P(B|A) Ã P(A)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"The general multiplication rule â works for all events. Multiply the probability of the first event by the conditional probability of the second given the first."})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 mb-6",children:[e.jsxs("div",{className:"rounded-xl border border-green-200 bg-green-50 p-5",children:[e.jsx("p",{className:"text-base font-bold text-green-800 mb-1",children:"Independent Events"}),e.jsx("p",{className:"text-lg font-mono font-bold text-green-900 mb-2",children:"P(A and B) = P(A) Ã P(B)"}),e.jsx("p",{className:"text-xs text-green-700",children:"Since P(A|B) = P(A) for independent events, the rule simplifies to the product of individual probabilities."})]}),e.jsxs("div",{className:"rounded-xl border border-blue-200 bg-blue-50 p-5",children:[e.jsx("p",{className:"text-base font-bold text-blue-800 mb-1",children:"Dependent Events"}),e.jsx("p",{className:"text-lg font-mono font-bold text-blue-900 mb-2",children:"P(A and B) = P(A|B) Ã P(B)"}),e.jsx("p",{className:"text-xs text-blue-700",children:"You must use the conditional probability since the events influence each other."})]})]}),e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Worked Example: Drawing Marbles"}),e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-5",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"A bag has 6 red marbles and 4 blue marbles. You draw two marbles without replacement. What is the probability of drawing two red marbles?"}),e.jsxs("div",{className:"rounded-lg bg-muted/60 p-3 font-mono text-sm space-y-1",children:[e.jsx("p",{children:"P(1st red) = 6/10"}),e.jsx("p",{children:"P(2nd red | 1st red) = 5/9"}),e.jsx("p",{children:"P(both red) = (6/10) Ã (5/9)"}),e.jsx("p",{className:"font-bold text-primary",children:"P(both red) = 30/90 = 1/3"})]})]})]}),e.jsxs("section",{id:"bayes-theorem",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#bayes-theorem",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-white text-sm font-bold",children:"6"}),"Bayes' Theorem",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsxs("p",{className:"text-muted-foreground mb-4",children:["Bayes' Theorem is a powerful tool for ",e.jsx("strong",{children:"reversing"})," conditional probabilities. It allows us to find P(A|B) if we know P(B|A), along with the individual probabilities of A and B. It is fundamental for updating our beliefs based on new evidence."]}),e.jsxs("div",{className:"rounded-xl bg-gradient-to-r from-primary/5 to-primary/10 border border-primary/20 p-6 mb-6 text-center",children:[e.jsx("p",{className:"text-3xl font-bold font-mono text-foreground mb-3",children:"P(A|B) = P(B|A) Ã P(A) / P(B)"}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"P(A|B)"})," = posterior probability (what we want)"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"P(B|A)"})," = likelihood (probability of evidence given hypothesis)"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"P(A)"})," = prior probability (initial belief)"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"P(B)"})," = total probability of evidence"]})]})]}),e.jsx("div",{className:"mb-6",children:e.jsx("img",{src:"/resources/conditional-probability/image_5_bayes_theorem.png",alt:"Bayes' Theorem diagram showing how prior probability is updated with new evidence to produce posterior probability, illustrated with a medical test scenario",className:"w-full rounded-xl border border-border",loading:"lazy"})}),e.jsx(Ie,{}),e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Law of Total Probability"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"When P(B) is not directly known, you can compute it using the Law of Total Probability:"}),e.jsxs("div",{className:"rounded-xl bg-gradient-to-r from-primary/5 to-primary/10 border border-primary/20 p-5 mb-6 text-center",children:[e.jsx("p",{className:"text-xl font-bold font-mono text-foreground",children:"P(B) = P(B|A) Ã P(A) + P(B|Aá¶) Ã P(Aá¶)"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:'Where Aá¶ is the complement of A (i.e., "not A").'})]}),e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Worked Example: Medical Test"}),e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-5",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"A rare disease affects 1% of the population. A test is 90% accurate: if you have the disease, it is positive 90% of the time; if you do not have the disease, it is negative 90% of the time (positive 10%). If a person tests positive, what is the probability they actually have the disease?"}),e.jsxs("div",{className:"rounded-lg bg-muted/60 p-3 font-mono text-sm space-y-1",children:[e.jsx("p",{children:"P(D) = 0.01, P(Dá
16¶) = 0.99"}),e.jsx("p",{children:"P(T+|D) = 0.90, P(T+|Dá¶) = 0.10"}),e.jsx("p",{className:"mt-2",children:"Step 1: Find P(T+)"}),e.jsx("p",{children:"P(T+) = (0.90)(0.01) + (0.10)(0.99)"}),e.jsx("p",{children:"P(T+) = 0.009 + 0.099 = 0.108"}),e.jsx("p",{className:"mt-2",children:"Step 2: Apply Bayes' Theorem"}),e.jsx("p",{children:"P(D|T+) = (0.90 Ã 0.01) / 0.108"}),e.jsx("p",{children:"P(D|T+) = 0.009 / 0.108"}),e.jsx("p",{className:"font-bold text-primary",children:"P(D|T+) â 0.0833 (about 8.33%)"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-3",children:"Even with a positive test, there is only about an 8.33% chance the person actually has the disease. The rarity of the disease (low prior probability) makes false positives a significant factor."})]})]}),e.jsxs("section",{id:"tables-and-diagrams",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#tables-and-diagrams",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-white text-sm font-bold",children:"7"}),"Two-Way Tables & Tree Diagrams",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"Visual aids are incredibly helpful for organizing information and solving conditional probability problems."}),e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Two-Way Tables"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"A two-way table (contingency table) displays the frequencies of two categorical variables. To find a conditional probability, restrict to the relevant row or column and divide."}),e.jsx("div",{className:"mb-6",children:e.jsx("img",{src:"/resources/conditional-probability/image_2_two_way_table.png",alt:"Two-way table example showing how to calculate conditional probability by restricting to a row or column total",className:"w-full rounded-xl border border-border",loading:"lazy"})}),e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-5 mb-6",children:[e.jsx("p",{className:"font-semibold text-foreground mb-3",children:"Worked Example: Favorite Subject Survey"}),e.jsx("div",{className:"overflow-x-auto mb-3",children:e.jsxs("table",{className:"w-full text-sm border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("th",{className:"text-left p-2 font-semibold"}),e.jsx("th",{className:"text-center p-2 font-semibold",children:"Math"}),e.jsx("th",{className:"text-center p-2 font-semibold",children:"English"}),e.jsx("th",{className:"text-center p-2 font-semibold",children:"Total"})]})}),e.jsxs("tbody",{children:[e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("td",{className:"p-2 font-semibold",children:"Boys"}),e.jsx("td",{className:"text-center p-2",children:"60"}),e.jsx("td",{className:"text-center p-2",children:"30"}),e.jsx("td",{className:"text-center p-2 font-semibold",children:"90"})]}),e.jsxs("tr",{className:"border-b border-border",children:[e.jsx("td",{className:"p-2 font-semibold",children:"Girls"}),e.jsx("td",{className:"text-center p-2",children:"40"}),e.jsx("td",{className:"text-center p-2",children:"70"}),e.jsx("td",{className:"text-center p-2 font-semibold",children:"110"})]}),e.jsxs("tr",{children:[e.jsx("td",{className:"p-2 font-semibold",children:"Total"}),e.jsx("td",{className:"text-center p-2 font-semibold",children:"100"}),e.jsx("td",{className:"text-center p-2 font-semibold",children:"100"}),e.jsx("td",{className:"text-center p-2 font-semibold",children:"200"})]})]})]})}),e.jsxs("div",{className:"rounded-lg bg-muted/60 p-3 font-mono text-sm space-y-1",children:[e.jsx("p",{children:"P(Math | Boy) = 60 / 90 = 2/3 â 0.667"}),e.jsx("p",{children:"P(Girl | English) = 70 / 100 = 7/10 = 0.7"})]})]}),e.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Tree Diagrams"}),e.jsxs("p",{className:"text-muted-foreground mb-4",children:["Tree diagrams are ideal for ",e.jsx("strong",{children:"sequential events"})," where the outcome of one event influences the next. Each path through the tree represents a sequence of events, and the probability of a complete path is the product of all branches along it."]}),e.jsx("div",{className:"mb-6",children:e.jsx("img",{src:"/resources/conditional-probability/image_3_tree_diagram.png",alt:"Tree diagram showing sequential conditional events with branches for Rain/No Rain and Traffic Jam/No Jam, with joint probabilities at each path endpoint",className:"w-full rounded-xl border border-border",loading:"lazy"})}),e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-5",children:[e.jsx("p",{className:"font-semibold text-foreground mb-2",children:"Reading a Tree Diagram"}),e.jsxs("div",{className:"rounded-lg bg-muted/60 p-3 font-mono text-sm space-y-1",children:[e.jsx("p",{children:"P(Rain) = 0.3, P(No Rain) = 0.7"}),e.jsx("p",{children:"P(Traffic Jam | Rain) = 0.8"}),e.jsx("p",{children:"P(Traffic Jam | No Rain) = 0.1"}),e.jsx("p",{className:"mt-2",children:"Path: Rain AND Traffic Jam"}),e.jsx("p",{className:"font-bold text-primary",children:"P(Rain and Jam) = 0.3 Ã 0.8 = 0.24"})]})]})]}),e.jsxs("section",{id:"memory-aids",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#memory-aids",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-white text-sm font-bold",children:"8"}),"Memory Aids",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10 p-5 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(T,{className:"h-4 w-4 text-primary flex-shrink-0"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-primary",children:"Mnemonic"})]}),e.jsx("p",{className:"text-xl italic font-serif text-foreground leading-relaxed",children:'"The Line Means Given!"'}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:'In P(A|B), the "|" literally means "given that." This helps translate the notation into plain English every time.'})]}),e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10 p-5 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(T,{className:"h-4 w-4 text-primary flex-shrink-0"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-primary",children:"Concept Phrase"})]}),e.jsx("p",{className:"text-xl italic font-serif text-foreground leading-relaxed",children:'"Conditional Probability Shrinks the World"'}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:'When you are given that event B has occurred, your "world" (denominator) shrinks to only those outcomes where B is true. You are no longer considering the entire sample space.'})]}),e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10 p-5 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(T,{className:"h-4 w-4 text-primary flex-shrink-0"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-primary",children:"Mnemonic"})]}),e.jsx("p",{className:"text-xl italic font-serif text-foreground leading-relaxed",children:'"AND means Multiply (with caution!)"'}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:'When you see "and" in a probability question, you are usually multiplying. Use P(A) Ã P(B|A) for dependent events, and P(A) Ã P(B) only for independent events.'})]}),e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10 p-5 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(T,{className:"h-4 w-4 text-primary flex-shrink-0"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-primary",children:"Concept Phrase"})]}),e.jsx("p",{className:"text-xl italic font-serif text-foreground leading-relaxed",children:`"Bayes' Theorem: Flip the Conditional!"`}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:`Bayes' Theorem helps you go from P(B|A) to P(A|B). Think of it as "flipping" the conditional statement, but you need the other pieces P(A) and P(B) to do it correctly.`})]}),e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10 p-5 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(T,{className:"h-4 w-4 text-primary flex-shrink-0"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-primary",children:"Mnemonic"})]}),e.jsx("p",{className:"text-xl italic font-serif text-foreground leading-relaxed",children:'"Independent = No Influence"'}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"If knowing B happened does not change the probability of A, then A and B are independent. They do not influence each other."})]}),e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10 p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(T,{className:"h-4 w-4 text-primary flex-shrink-0"}),e.jsx("span",{className:"text-xs font-bold uppercase tracking-widest text-primary",children:"Mnemonic"})]}),e.jsx("p",{className:"text-xl italic font-serif text-foreground leading-relaxed",children:'"Mutually Exclusive = No Overlap"'}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"If events are mutually exclusive, they cannot happen together, so their intersection P(A and B) is zero. Picture Venn diagrams with two separate circles that do not touch."})]})]}),e.jsxs("section",{id:"common-mistakes",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#common-mistakes",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary text-white text-sm font-bold",children:"9"}),"Common Mistakes",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50/50 p-5",children:[e.jsx("p",{className:"font-semibold text-red-800 mb
16-1",children:"Confusing P(A and B) with P(A|B)"}),e.jsx("p",{className:"text-sm text-red-700",children:"P(A and B) is the probability of both events happening in the entire sample space. P(A|B) is the probability of A happening only within the subset where B has already occurred. They are different quantities."})]}),e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50/50 p-5",children:[e.jsx("p",{className:"font-semibold text-red-800 mb-1",children:"Forgetting to update the sample space (denominator)"}),e.jsx("p",{className:"text-sm text-red-700",children:"When calculating P(A|B), the denominator must be P(B) (or the count of B), not the total sample space. This is the most frequent error in conditional probability."})]}),e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50/50 p-5",children:[e.jsx("p",{className:"font-semibold text-red-800 mb-1",children:"Incorrectly assuming independence"}),e.jsx("p",{className:"text-sm text-red-700",children:"Do not assume events are independent unless explicitly stated or proven. Always test for independence using P(A|B) = P(A) or use the general multiplication rule P(A and B) = P(A) Ã P(B|A)."})]}),e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50/50 p-5",children:[e.jsx("p",{className:"font-semibold text-red-800 mb-1",children:"Confusing mutually exclusive with independent"}),e.jsx("p",{className:"text-sm text-red-700",children:"Mutually exclusive means P(A and B) = 0 â if A happens, B cannot. Independent means P(A|B) = P(A) â knowing B does not change A's probability. If events are mutually exclusive with non-zero probabilities, they are actually highly dependent."})]}),e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50/50 p-5",children:[e.jsx("p",{className:"font-semibold text-red-800 mb-1",children:"Flipping the conditional incorrectly"}),e.jsx("p",{className:"text-sm text-red-700",children:`P(A|B) is generally not equal to P(B|A). You must use Bayes' Theorem to correctly "flip" a conditional probability. For example, P(Disease|Positive Test) is very different from P(Positive Test|Disease).`})]}),e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50/50 p-5",children:[e.jsx("p",{className:"font-semibold text-red-800 mb-1",children:"Not drawing a diagram"}),e.jsx("p",{className:"text-sm text-red-700",children:"For complex problems, tree diagrams and two-way tables are invaluable for organizing information and avoiding errors. Skipping the visual step often leads to mistakes in multi-step problems."})]}),e.jsxs("div",{className:"rounded-xl border border-red-200 bg-red-50/50 p-5",children:[e.jsx("p",{className:"font-semibold text-red-800 mb-1",children:"Calculation errors with small probabilities"}),e.jsx("p",{className:"text-sm text-red-700",children:"Double-check your arithmetic, especially when dealing with multiple steps or small probabilities in Bayes' Theorem. A misplaced decimal can dramatically change your answer."})]})]})]}),e.jsxs("section",{id:"revision-summary",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#revision-summary",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-4 flex items-center gap-2",children:["Quick Revision Summary",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsx("div",{className:"rounded-xl border border-border bg-muted/30 p-6",children:e.jsxs("ul",{className:"space-y-2 text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold mt-0.5",children:"â"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Conditional probability"})," updates probabilities based on new information: P(A|B) = P(A â© B) / P(B)."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold mt-0.5",children:"â"}),e.jsxs("span",{children:["The denominator ",e.jsx("strong",{children:"P(B)"})," represents the ",e.jsx("strong",{children:"reduced sample space"})," â only outcomes where B is true."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold mt-0.5",children:"â"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Independent events:"})," P(A|B) = P(A). Knowing B does not change A's probability."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold mt-0.5",children:"â"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Dependent events:"})," P(A|B) â P(A). Knowing B changes A's probability."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold mt-0.5",children:"â"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Multiplication rule (general):"})," P(A and B) = P(A|B) Ã P(B)."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold mt-0.5",children:"â"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Multiplication rule (independent):"})," P(A and B) = P(A) Ã P(B)."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold mt-0.5",children:"â"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Bayes' Theorem:"})," P(A|B) = P(B|A) Ã P(A) / P(B) â reverses conditional probabilities."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold mt-0.5",children:"â"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Tree diagrams"})," are best for sequential events; ",e.jsx("strong",{children:"two-way tables"})," are best for categorical data."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold mt-0.5",children:"â"}),e.jsxs("span",{children:["P(A|B) is generally ",e.jsx("strong",{children:"not"})," equal to P(B|A) â use Bayes' Theorem to flip conditionals."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold mt-0.5",children:"â"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Mutually exclusive"})," events with non-zero probabilities are always ",e.jsx("strong",{children:"dependent"}),", not independent."]})]})]})})]}),e.jsxs("section",{id:"faq",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#faq",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-6 flex items-center gap-2",children:["Frequently Asked Questions",e.
16jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsx("dl",{className:"space-y-5",children:ie.map((s,P)=>e.jsxs("div",{className:"rounded-xl border border-border p-5",children:[e.jsx("dt",{className:"font-semibold text-foreground mb-2",children:s.question}),e.jsx("dd",{className:"text-muted-foreground",children:s.answer})]},P))})]}),e.jsxs("section",{id:"quiz",className:"mb-14 scroll-mt-20",children:[e.jsx("a",{href:"#quiz",className:"group no-underline",children:e.jsxs("h2",{className:"text-2xl font-bold mb-2 flex items-center gap-2",children:["Practice Quiz",e.jsx(l,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})}),e.jsx(ke,{headless:!0})]}),e.jsxs("section",{className:"mb-14 rounded-xl border border-border bg-muted/30 p-6",children:[e.jsx("h2",{className:"text-xl font-bold mb-4",children:"Final Study Advice"}),e.jsxs("ul",{className:"space-y-2 text-muted-foreground",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold",children:"1."}),e.jsxs("span",{children:["Always identify whether events are ",e.jsx("strong",{children:"independent or dependent"})," before choosing a formula."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold",children:"2."}),e.jsxs("span",{children:["Draw a ",e.jsx("strong",{children:"tree diagram or two-way table"})," for complex problems â they organize information and reduce errors."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold",children:"3."}),e.jsxs("span",{children:["Remember that P(A|B) â P(B|A) in general â always check which ",e.jsx("strong",{children:"direction"})," the conditional goes."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold",children:"4."}),e.jsxs("span",{children:["For Bayes' Theorem problems, ",e.jsx("strong",{children:"find P(B) first"})," using the Law of Total Probability before plugging into the formula."]})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"text-primary font-bold",children:"5."}),e.jsxs("span",{children:["Practice with real-world scenarios (medical tests, card draws, surveys) to build ",e.jsx("strong",{children:"intuition"})," for conditional reasoning."]})]})]})]}),e.jsxs("section",{className:"rounded-xl border border-border bg-muted/30 p-6",children:[e.jsx("h2",{className:"text-xl font-semibold mb-3",children:"Related Topics"}),e.jsxs("ul",{className:"space-y-2",children:[e.jsx("li",{children:e.jsx($,{to:"/resources/mathematics/probability-basics",className:"text-primary hover:underline",children:"Probability Basics"})}),e.jsx("li",{children:e.jsx($,{to:"/resources/mathematics/discrete-random-variables",className:"text-primary hover:underline",children:"Discrete Random Variables"})})]})]})]})]})})]})}export{Le as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.