# Expected Value

The expected value of a random variable is the weighted average of all possible values of the variable. The weight here means the probability of the random variable taking a specific value.

### Expected Value of Discrete Random Variable

$$
E\[X] = \sum x\_i \times P(x\_i)
$$

Where $$x\_i$$equal to the values that $$X$$takes and $$P(x\_i)$$ is the probability that $$X$$ takes the value $$x\_i$$&#x20;

### Expected Value of Continuous Random Variable

Since continuous random variables can take uncountably infinitely many values, we cannot talk about a variable taking a specific value. We rather focus on value ranges.

In order to calculate the probability of value ranges, probability density functions (PDF) are used.&#x20;

{% hint style="danger" %}
PDF is a function that specifies the probability of a random variable taking value within a particular range.
{% endhint %}

$$
E\[X] = \int\_{x\_{min}}^{x\_{max}} x \times f(x) dx
$$

Where $$f(x)$$ is the PDF of $$X$$


---

# Agent Instructions: 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:

```
GET https://ai.nuhil.net/statistics/expected-value.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
