# Question about computing variance for normalization

**URL:** <https://community.deeplearning.ai/t/question-about-computing-variance-for-normalization/16531>\
**Category:** Improving Deep Neural Networks: Hyperparameter tun\
**Tags:** coursera-platform\
**Created:** [June 23, 2021, 12:24am UTC](https://community.deeplearning.ai/t/question-about-computing-variance-for-normalization/16531 "2021-06-23T00:24:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wan](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@Wan](https://community.deeplearning.ai/u/Wan)\
**Post date:** [June 23, 2021, 12:24am UTC](https://community.deeplearning.ai/t/question-about-computing-variance-for-normalization/16531/1 "2021-06-23T00:24:54Z")

</div>

Hi all,

I have an ABC question about computing variance.  
As I know, the variance sigma^2 should be:  
f1: sigma^2 = 1/(m-1) \* sum((x - μ)\*\*2) → All variable Xi should substract the mean;

But in the slides, the formula is :  
f2: sigma^2 = 1/m \* sum(x\*\*2) → without subtracting the mean.

Are there any mistakes in my formula f1? If f1 is ok, why does the formula f2 work?  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![jaydeep24](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@jaydeep24](https://community.deeplearning.ai/u/jaydeep24)\
**Post date:** [June 23, 2021, 4:22pm UTC](https://community.deeplearning.ai/t/question-about-computing-variance-for-normalization/16531/2 "2021-06-23T16:22:25Z")

</div>

![Screenshot 2021-06-23 214730](https://global.discourse-cdn.com/dlai/original/2X/8/8681c7d10a3f12f4966388cddb2c72d3368d73e0.png)  
If you check out on left bottom, what is done here is that, first we subtract the mean from our x and then we use that x and square it. So overall it is same as your f1, it’s just that here it is broken into two different parts and solved.

---

<div class="post-metadata">

**Author:** ![Wan](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@Wan](https://community.deeplearning.ai/u/Wan)\
**Post date:** [June 23, 2021, 9:05pm UTC](https://community.deeplearning.ai/t/question-about-computing-variance-for-normalization/16531/3 "2021-06-23T21:05:04Z")

</div>

Thank you so much! I misunderstood it.  
But why does it use 1/m rather than unbiased estimate 1/(m-1)？

---

<div class="post-metadata">

**Author:** ![jaydeep24](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@jaydeep24](https://community.deeplearning.ai/u/jaydeep24)\
**Post date:** [June 24, 2021, 1:11pm UTC](https://community.deeplearning.ai/t/question-about-computing-variance-for-normalization/16531/4 "2021-06-24T13:11:16Z")

</div>

Not sure about that, but I think here we consider the training set as the population and then make assumptions using that hence 1/m. Though using 1/(m-1) won’t harm.

---

<div class="post-metadata">

**Author:** ![Wan](https://avatars.discourse-cdn.com/v4/letter/w/8dc957/32.png) [@Wan](https://community.deeplearning.ai/u/Wan)\
**Post date:** [June 24, 2021, 9:07pm UTC](https://community.deeplearning.ai/t/question-about-computing-variance-for-normalization/16531/5 "2021-06-24T21:07:29Z")

</div>

Make sense. if assume that the training dataset is the population, the 1/m is already unbiased.

Thank you.
