How does bagging reduce variance?

I read this answer. Was still unable to understand how bagging reduces variance.

Is there any other way to explain it mathematically to a newbie ?

Edit

Can anybody explain me this excerpt from the other answer?

by averaging the outputs of $$B$$ trees, the variance of the final prediction is given by $$p \sigma^2 + (1 - p)\sigma^2/ B,$$ where $$p$$ is the pairwise correlation between trees.

• Does this answer your question? How can we explain the fact that "Bagging reduces the variance while retaining the bias" mathematically? Commented Sep 12, 2020 at 23:01
• I have mentioned in my Q statement that I checked "that" answer already, but failed to understand. It would be very useful if it's described in some other way. Commented Sep 12, 2020 at 23:04
• What part of the other answer do you not understand? Can you be more specific about what you understand from the other answer and what is not clear to you?
– Sycorax
Commented Sep 12, 2020 at 23:19
• Hi, I edited my question- mentioned what I couldn't understand in the other answer. Plz see once. Commented Sep 13, 2020 at 10:33

In your case the $$a_i$$ is $$1/B$$.
This gives the answer but in terms of variance and covariance. Thus you just change the covariance to correlation via $$covariance(X_i, X_j) = correlation(X_i, X_j) sd(X_i) sd(Y_i)$$.