scrapbook
  • "Unorganized" Notes
  • The Best Public Datasets for Machine Learning and Data Science
  • Practice Coding
  • plaid-API project
  • Biotech
    • Machine Learning vs. Deep Learning
  • Machine Learning for Computer Graphics
  • Books (on GitHub)
  • Ideas/Thoughts
  • Ziva for feature animation: Stylized simulation and machine learning-ready workflows
  • Tools
  • 🪶math
    • Papers
    • Math for ML (coursera)
      • Linear Algebra
        • Wk1
        • Wk2
        • Wk3
        • Wk4
        • Wk5
      • Multivariate Calculus
    • Improving your Algorithms & Data Structure Skills
    • Algorithms
    • Algorithms (MIT)
      • Lecture 1: Algorithmic Thinking, Peak Finding
    • Algorithms (khan academy)
      • Binary Search
      • Asymptotic notation
      • Sorting
      • Insertion sort
      • Recursion
      • Solve Hanoi recursively
      • Merge Sort
      • Representing graphs
      • The breadth-first search algorithm
      • Breadth First Search in JavaScript
      • Breadth-first vs Depth-first Tree Traversal in Javascript
    • Algorithms (udacity)
      • Social Network
    • Udacity
      • Linear Algebra Refresher /w Python
    • math-notes
      • functions
      • differential calculus
      • derivative
      • extras
      • Exponentials & logarithms
      • Trigonometry
    • Probability (MIT)
      • Unit 1
        • Probability Models and Axioms
        • Mathematical background: Sets; sequences, limits, and series; (un)countable sets.
    • Statistics and probability (khan academy)
      • Analyzing categorical data
      • Describing and comparing distributions
      • Outliers Definition
      • Mean Absolute Deviation (MAD)
      • Modeling data distribution
      • Exploring bivariate numerical data
      • Study Design
      • Probability
      • Counting, permutations, and combinations
      • Binomial variables
        • Binomial Distribution
        • Binomial mean and standard deviation formulas
        • Geometric random variable
      • Central Limit Theorem
      • Significance Tests (hypothesis testing)
    • Statistics (hackerrank)
      • Mean, Medium, Mode
      • Weighted Mean
      • Quartiles
      • Standard Deviation
      • Basic Probability
      • Conditional Probability
      • Permutations & Combinations
      • Binomial Distribution
      • Negative Binomial
      • Poisson Distribution
      • Normal Distribution
      • Central Limit Theorem
      • Important Concepts in Bayesian Statistics
  • 📽️PRODUCT
    • Product Strategy
    • Product Design
    • Product Development
    • Product Launch
  • 👨‍💻coding
    • of any interest
    • Maya API
      • Python API
    • Python
      • Understanding Class Inheritance in Python 3
      • 100+ Python challenging programming exercises
      • coding
      • Iterables vs. Iterators vs. Generators
      • Generator Expression
      • Stacks (LIFO) / Queues (FIFO)
      • What does -1 mean in numpy reshape?
      • Fold Left and Right in Python
      • Flatten a nested list of lists
      • Flatten a nested dictionary
      • Traverse A Tree
      • How to Implement Breadth-First Search
      • Breadth First Search
        • Level Order Tree Traversal
        • Breadth First Search or BFS for a Graph
        • BFS for Disconnected Graph
      • Trees and Tree Algorithms
      • Graph and its representations
      • Graph Data Structure Interview Questions
      • Graphs in Python
      • GitHub Repo's
    • Python in CG Production
    • GLSL/HLSL Shading programming
    • Deep Learning Specialization
      • Neural Networks and Deep Learning
      • Untitled
      • Untitled
      • Untitled
    • TensorFlow for AI, ML, and DL
      • Google ML Crash Course
      • TensorFlow C++ API
      • TensorFlow - coursera
      • Notes
      • An Introduction to different Types of Convolutions in Deep Learning
      • One by One [ 1 x 1 ] Convolution - counter-intuitively useful
      • SqueezeNet
      • Deep Compression
      • An Overview of ResNet and its Variants
      • Introducing capsule networks
      • What is a CapsNet or Capsule Network?
      • Xception
      • TensorFlow Eager
    • GitHub
      • Project README
    • Agile - User Stories
    • The Open-Source Data Science Masters
    • Coding Challenge Websites
    • Coding Interview
      • leetcode python
      • Data Structures
        • Arrays
        • Linked List
        • Hash Tables
        • Trees: Basic
        • Heaps, Stacks, Queues
        • Graphs
          • Shortest Path
      • Sorting & Searching
        • Depth-First Search & Breadth-First Search
        • Backtracking
        • Sorting
      • Dynamic Programming
        • Dynamic Programming: Basic
        • Dynamic Programming: Advanced
    • spaCy
    • Pandas
    • Python Packages
    • Julia
      • jupyter
    • macos
    • CPP
      • Debugging
      • Overview of memory management problems
      • What are lvalues and rvalues?
      • The Rule of Five
      • Concurrency
      • Avoiding Data Races
      • Mutex
      • The Monitor Object Pattern
      • Lambdas
      • Maya C++ API Programming Tips
      • How can I read and parse CSV files in C++?
      • Cpp NumPy
    • Advanced Machine Learning
      • Wk 1
      • Untitled
      • Untitled
      • Untitled
      • Untitled
  • data science
    • Resources
    • Tensorflow C++
    • Computerphile
      • Big Data
    • Google ML Crash Course
    • Kaggle
      • Data Versioning
      • The Basics of Rest APIs
      • How to Make an API
      • How to deploying your API
    • Jupiter Notebook Tips & Tricks
      • Jupyter
    • Image Datasets Notes
    • DS Cheatsheets
      • Websites & Blogs
      • Q&A
      • Strata
      • Data Visualisation
      • Matplotlib etc
      • Keras
      • Spark
      • Probability
      • Machine Learning
        • Fast Computation of AUC-ROC score
    • Data Visualisation
    • fast.ai
      • deep learning
      • How to work with Jupyter Notebook on a remote machine (Linux)
      • Up and Running With Fast.ai and Docker
      • AWS
    • Data Scientist
    • ML for Beginners (Video)
    • ML Mastery
      • Machine Learning Algorithms
      • Deep Learning With Python
    • Linear algebra cheat sheet for deep learning
    • DL_ML_Resources
    • Awesome Machine Learning
    • web scraping
    • SQL Style Guide
    • SQL - Tips & Tricks
  • 💡Ideas & Thoughts
    • Outdoors
    • Blog
      • markdown
      • How to survive your first day as an On-set VFX Supervisor
    • Book Recommendations by Demi Lee
  • career
    • Skills
    • learn.co
      • SQL
      • Distribution
      • Hypothesis Testing Glossary
      • Hypothesis Tests
      • Hypothesis & AB Testing
      • Combinatorics Continued and Maximum Likelihood Estimation
      • Bayesian Classification
      • Resampling and Monte Carlo Simulation
      • Extensions To Linear Models
      • Time Series
      • Distance Metrics
      • Graph Theory
      • Logistic Regression
      • MLE (Maximum Likelihood Estimation)
      • Gradient Descent
      • Decision Trees
      • Ensemble Methods
      • Spark
      • Machine Learning
      • Deep Learning
        • Backpropagation - math notation
        • PRACTICE DATASETS
        • Big Data
      • Deep Learning Resources
      • DL Datasets
      • DL Tutorials
      • Keras
      • Word2Vec
        • Word2Vec Tutorial Part 1 - The Skip-Gram Model
        • Word2Vec Tutorial Part 2 - Negative Sampling
        • An Intuitive Explanation of Convolutional Neural Networks
      • Mod 4 Project
        • Presentation
      • Mod 5 Project
      • Capstone Project Notes
        • Streaming large training and test files into Tensorflow's DNNClassifier
    • Carrier Prep
      • The Job Search
        • Building a Strong Job Search Foundation
        • Key Traits of Successful Job Seekers
        • Your Job Search Mindset
        • Confidence
        • Job Search Action Plan
        • CSC Weekly Activity
        • Managing Your Job Search
      • Your Online Presence
        • GitHub
      • Building Your Resume
        • Writing Your Resume Summary
        • Technical Experience
      • Effective Networking
        • 30 Second Elevator Pitch
        • Leveraging Your Network
        • Building an Online Network
        • Linkedin For Research And Networking
        • Building An In-Person Network
        • Opening The Line Of Communication
      • Applying to Jobs
        • Applying To Jobs Online
        • Cover Letters
      • Interviewing
        • Networking Coffees vs Formal Interviews
        • The Coffee Meeting/ Informational Interview
        • Communicating With Recruiters And HR Professional
        • Research Before an Interview
        • Preparing Questions for Interviews
        • Phone And Video/Virtual Interviews
        • Cultural/HR Interview Questions
        • The Salary Question
        • Talking About Apps/Projects You Built
        • Sending Thank You's After an Interview
      • Technical Interviewing
        • Technical Interviewing Formats
        • Code Challenge Best Practices
        • Technical Interviewing Resources
      • Communication
        • Following Up
        • When You Haven't Heard From an Employer
      • Job Offers
        • Approaching Salary Negotiations
      • Staying Current in the Tech Industry
      • Module 6 Post Work
      • Interview Prep
  • projects
    • Text Classification
    • TERRA-REF
    • saildrone
  • Computer Graphics
  • AI/ML
  • 3deeplearning
    • Fast and Deep Deformation Approximations
    • Compress and Denoise MoCap with Autoencoders
    • ‘Fast and Deep Deformation Approximations’ Implementation
    • Running a NeuralNet live in Maya in a Python DG Node
    • Implement a Substance like Normal Map Generator with a Convolutional Network
    • Deploying Neural Nets to the Maya C++ API
  • Tools/Plugins
  • AR/VR
  • Game Engine
  • Rigging
    • Deformer Ideas
    • Research
    • brave rabbit
    • Useful Rigging Links
  • Maya
    • Optimizing Node Graph for Parallel Evaluation
  • Houdini
    • Stuff
    • Popular Built-in VEX Attributes (Global Variables)
Powered by GitBook
On this page
  • Event, Sample Space, and Probability
  • Compound Events, Mutually Exclusive Events, and Collectively Exhaustive Events
  • Task
  1. math
  2. Statistics (hackerrank)

Basic Probability

PreviousStandard DeviationNextConditional Probability

Last updated 6 years ago

Event, Sample Space, and Probability

In probability theory, an experiment is any procedure that can be infinitely repeated and has a well-defined set of possible outcomes, known as the sample space, SSS. We define an event to be a set of outcomes of an experiment (also known as a subset of SSS) to which a probability (numerical value) is assigned.

The probability of the occurrence of an event, AAA, is:

P(A)=Number of favorable outcomesTotal number of outcomes\huge P(A) =\frac{\text{Number of favorable outcomes}}{\text{Total number of outcomes}}P(A)=Total number of outcomesNumber of favorable outcomes​

Here are the first two fundamental rules of probability:

  1. Any probability, P(A)P(A)P(A), is a number between 000 and 111 (i.e., 0≤P(A)≤10\leq P(A) \leq10≤P(A)≤1).

  2. The probability of the sample space, SSS, is 111 (i.e., P(S)=1P(S) = 1P(S)=1).

So how do we bridge the gap between the value of P(A)P(A)P(A) and the sample space? Quite simply, since we know that P(A)P(A)P(A) is the probability that event AAA will occur, then we define P(A′)P(A')P(A′) (also written as P(Ac)P(A^c)P(Ac)) to be the probability that event will not occur (the complement of P(A)P(A)P(A)). If our sample space is composed of the probabilities of 's occurrence and non-occurrence, we can then say P(A)+P(A′)=1P(A) + P(A')=1P(A)+P(A′)=1, or the sum of all possible outcomes of AAA in the sample space is equal to 111. This is the third fundamental rule of probability: P(Ac)=1−P(A)\newline P(A^c)=1 - P(A)P(Ac)=1−P(A).

Question 1 Find the probability of getting an odd number when rolling a 666-sided fair die.

Given the above question, we can extract the following:

  • Experiment: rolling a 666-sided die.

  • Sample space (SSS): S={1,2,3,4,5,6}S=\{1, 2, 3, 4, 5, 6\}S={1,2,3,4,5,6}.

  • Event (AAA): that the number rolled is odd (i.e., A={1,3,5}A=\{1, 3, 5\}A={1,3,5}).

If we refer back to the basic formula for the probability of the occurrence of an event, we can say: P(A)=Number of favorable outcomesTotal number of outcomes=∣A∣∣S∣=36=12\large P(A) =\frac{\text{Number of favorable outcomes}}{\text{Total number of outcomes}} = \frac{\vert{A}\vert}{\vert{S}\vert} =\frac{3}{6}=\frac{1}{2}P(A)=Total number of outcomesNumber of favorable outcomes​=∣S∣∣A∣​=63​=21​

Compound Events, Mutually Exclusive Events, and Collectively Exhaustive Events

Let's consider 222 events: AAA and BBB. A compound event is a combination of 222 or more simple events. If AAA and BBB are simple events, then A∪BA\cup BA∪B denotes the occurrence of either AAA or BBB. Similarly, A∩BA\cap BA∩B denotes the occurrence of AAA and BBB together.

Given the above question, we can extract the following:

We can use our fundamental rules of probability to solve this problem:

Task

Solution

Urn X has a 4/7 probability of giving a red ball Urn Y has a 5/9 probability of giving a red ball Urn Z has a 1/2 probability of giving a red ball

Urn X has a 3/7 probability of giving a black ball Urn Y has a 4/9 probability of giving a black ball Urn Z has a 1/2 probability of giving a black ball

P(2 red, 1 black) = P(Red Red Black) + P(Red Black Red) + P(Black Red Red) = (4/7)(5/9)(1/2) + (4/7)(4/9)(1/2) + (3/7)(5/9)(1/2) = 20/126 + 16/126 + 15/126 = 51/126 = 17/42

AAA and BBB are said to be mutually exclusive or disjoint if they have no events in common (i.e., A∩B=∅A \cap B = \emptyset A∩B=∅ and P(A∩B)=0P(A \cap B) = 0P(A∩B)=0). The probability of any of 222 or more events occurring is the union (∪\cup∪) of events. Because disjoint probabilities have no common events, the probability of the union of disjoint events is the sum of the events' individual probabilities. AAA and BBB are said to be collectively exhaustive if their union covers all events in the sample space (i.e., A∪B=SA \cup B = SA∪B=S and P(A∪B)=1P(A \cup B) = 1P(A∪B)=1). This brings us to our next fundamental rule of probability: if 222 events, AAA and BBB, are disjoint, then the probability of either event is the sum of the probabilities of the 222 events (i.e., P(A orB)=P(A)+P(B)P(A \ or B) = P(A) + P(B)P(A orB)=P(A)+P(B)).

If the outcome of the first event (AAA) has no impact on the second event (BBB), then they are considered to be independent (e.g., tossing a fair coin). This brings us to the next fundamental rule of probability: the multiplication rule. It states that if two events, AAA and BBB, are independent, then the probability of both events is the product of the probabilities for each event (i.e., P(A and B)=P(A)∗P(B)P(A \ and\ B) = P(A) * P(B)P(A and B)=P(A)∗P(B)). The chance of all events occurring in a sequence of events is called the intersection (∩\cap∩) of those events.

Question 2 Find the probability of getting 111head and 111 tail when 222 fair coins are tossed.

Experiment: tossing 222 coins.

Sample space (SSS): The possible outcomes for the toss of 111 coin are {H,T}\{H, T\}{H,T}, where H=headsH = headsH=heads and T=tailsT = tailsT=tails. As our experiment tosses 222 coins, we have to consider all possible toss outcomes by finding the Cartesian Product of the possible outcomes for each coin: S={{H,T}∗{H,T}={(H,H),(H,T),(T,H),(T,T)}\newline S = \{\{ H, T\} *\{H, T\} = \{(H,H),(H,T),(T,H),(T,T)\}S={{H,T}∗{H,T}={(H,H),(H,T),(T,H),(T,T)}.

Event (A∩BA \cap BA∩B): that the outcome of 111 toss will be HHH, and the outcome of the other toss will be TTT(i.e., A={(H,T),(T,H)}A=\{(H, T), (T, H)\}A={(H,T),(T,H)}.

Connecting this information back to our basic formula for P(A)P(A)P(A), we can say:

P(A)=Number of favorable outcomesTotal number of outcomes=∣A∣∣S∣=24=12\large P(A) =\frac{\text{Number of favorable outcomes}}{\text{Total number of outcomes}} = \frac{\vert{A}\vert}{\vert{S}\vert} =\frac{2}{4}=\frac{1}{2}P(A)=Total number of outcomesNumber of favorable outcomes​=∣S∣∣A∣​=42​=21​

Question 3 Let AAA and BBB be two events such that P(A)=25P(A)=\frac{2}{5}P(A)=52​ and P(B)=45P(B)=\frac{4}{5}P(B)=54​. If the probability of the occurrence of either AAA or BBB is 35\frac{3}{5}53​, find the probability of the occurrence of both AAA and BBB together (i.e., A∩BA \cap BA∩B).

∣A∪B∣=∣A∣+∣B∣−∣A∩B∣⇒P(A∪B)=P(A)+P(B)−P(A∩B)⇒P(A∩B)=P(A)+P(B)−P(A∪B)⇒P(A∪B)=25+45−35=35\vert A \cup B\vert = \vert A \vert + \vert B \vert - \vert A \cap B\vert \newline \Rightarrow P(A \cup B) = P(A)+P(B)-P(A \cap B)\newline \Rightarrow P(A \cap B) = P(A)+P(B)-P(A \cup B)\newline \Rightarrow P(A \cup B) = \frac{2}{5}+\frac{4}{5} -\frac{3}{5}=\frac{3}{5}∣A∪B∣=∣A∣+∣B∣−∣A∩B∣⇒P(A∪B)=P(A)+P(B)−P(A∩B)⇒P(A∩B)=P(A)+P(B)−P(A∪B)⇒P(A∪B)=52​+54​−53​=53​

There are urns labeled XXX, YYY, and ZZZ.

Urn XXX contains 444 red balls and 333 black balls.

Urn YYY contains 555 red balls and 444 black balls.

Urn ZZZ contains 444 red balls and 444 black balls.

One ball is drawn from each of the 333 urns. What is the probability that, of the 333 balls drawn, 222 are red and 111 is black?

🪶