> For the complete documentation index, see [llms.txt](https://stephanosterburg.gitbook.io/scrapbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stephanosterburg.gitbook.io/scrapbook/math/statistics-and-probability/binomial-variables/binomial-mean-and-standard-deviation-formulas.md).

# Binomial mean and standard deviation formulas

### Mean and variance of Bernoulli distribution example

unfavorable = 40% ----> 0

favorable = 60% ----> 1

We map the values to a 0 and 1.

#### Mean:

$$\mu = 0.4 \cdot 0 + 0.6 \cdot  1 = 0.6$$

#### Variance:

$$\sigma^2 = 0.4 \cdot (0-0.6)^2 + 0.6 \cdot (1 - 0.6)^2 \newline \sigma^2 = 0.4 \cdot 0.36 + 0.6 \cdot 0.16\newline \sigma^2 = 0.24\newline \sigma\ \ =\sqrt{0.24} = 0.49$$

### Bernoulli distribution mean and variance formulas

unfavorable = 40% ----> 0 ===> we change it to (1 - p) -> failure

favorable = 60% ----> 1 ===> we change it to (p) -> success

$$\mu = (1-p) \cdot 0 + p \cdot 1 = p$$

$$\sigma^2=(1 -p)(0-p)^2 + p(1-p)^2\newline  \sigma^2 = (1-p)p^2 +p(1-2p+p^2)\newline \sigma^2 = p^2 -p^3+p-2p^2+p^3\newline \sigma^2= p-p^2 \newline \sigma^2 = p(1-p)$$

### [Expected value of a binomial variable](/scrapbook/math/hackerrank.md)

(see Statistics (hackerrank)/Poisson Distribution)

X = # of successes after $$n$$ trials where P(success) for each trial is $$p$$

$$E(X)=n \cdot p$$

$$E(X+Y)=E(X)+E(Y)$$

### Finding the mean and standard deviation of a binomial random variable

> A company produces cell phone chips. 2% of them are defect. A quality check involves randomly selecting and testing 500 chips.
>
> What are the mean and standard deviation?

$$X$$= # of defective chips in 500 chip sample

$$\mu\_x=E(X)=n \cdot p \newline \mu\_x = 500 \cdot 0.02 = 10$$

$$\sigma\_x = \sqrt{\sigma\_x^2} = \sqrt{Var(X)}=\sqrt{n \cdot p \cdot (1-p)}=\sqrt{500 \cdot 0.02 \cdot 0.98} = \sqrt{9.8} = 3.13$$


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://stephanosterburg.gitbook.io/scrapbook/math/statistics-and-probability/binomial-variables/binomial-mean-and-standard-deviation-formulas.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
