# How to find variance

**URL:** <https://community.deeplearning.ai/t/how-to-find-variance/652675>\
**Category:** Probability & Statistics for Machine Learning &...\
**Tags:** week-module-2\
**Created:** [June 24, 2024, 8:04am UTC](https://community.deeplearning.ai/t/how-to-find-variance/652675 "2024-06-24T08:04:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshit8](https://avatars.discourse-cdn.com/v4/letter/h/898d66/32.png) [@harshit8](https://community.deeplearning.ai/u/harshit8)\
**Post date:** [June 24, 2024, 8:04am UTC](https://community.deeplearning.ai/t/how-to-find-variance/652675/1 "2024-06-24T08:04:18Z")

</div>

> **[Joint Distribution (Continuous) - Week 2 - Describing probability...](https://www.coursera.org/lecture/machine-learning-probability-and-statistics/joint-distribution-continuous-01lzv)**
>
> Video created by DeepLearning.AI for the course "Probability & Statistics for Machine Learning & Data Science". This week you will learn about different measures to describe probability distributions as well as any dataset. These include...

while finding variance  
var(x)=E[X^2]-E^2

How to find this term : E[X^2]

---

<div class="post-metadata">

**Author:** ![Alireza\_Saei](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/alireza_saei/32/85175_2.png) [@Alireza\_Saei](https://community.deeplearning.ai/u/Alireza_Saei)\
**Post date:** [June 24, 2024, 12:52pm UTC](https://community.deeplearning.ai/t/how-to-find-variance/652675/2 "2024-06-24T12:52:35Z")

</div>

Hi @harshit8

You need to calculate the expected value of the squared random variable X .

For a discrete random variable X:

E[X^2] = \sum (x\_i^2 \cdot p\_i)

For a continuous random variable X (f(x) is density function):

E[X^2] = \int\_{-\infty}^{\infty} x^2 f(x) \, dx

Hope this helps, feel free to ask if you need further help!
