Latex Code for Correlation Formula

The following are the correlation formula. Below includes tutorials showing how to write it as Latex code in Markdown and WordPress.

\[r_{xy}=\frac{\sum_{i=1}^{n}((x_i-\bar{x})(y_i-\bar{y}))}{\sqrt{\sum_{i=1}^{n}(x_i-\bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i-\bar{y})^2}}\]

Latex Code for Correlation Formula

The following is the Latex code for correlation formula.

r_{xy}=\frac{\sum_{i=1}^{n}((x_i-\bar{x})(y_i-\bar{y}))}{\sqrt{\sum_{i=1}^{n}(x_i-\bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i-\bar{y})^2}}

Latex Code for Correlation Formula in Markdown

You can use the following Latex code to show the correlation formula in R Markdown or Markdown in Python Jupyter notebook

$r_{xy}=\frac{\sum_{i=1}^{n}((x_i-\bar{x})(y_i-\bar{y}))}{\sqrt{\sum_{i=1}^{n}(x_i-\bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i-\bar{y})^2}}$

Latex Code for Correlation Formula on WordPress

To show correlation formula in WordPress (like you see at the beginning of this post), you can use its short code and paste the following to show it.

Note that, the <script>...</script> part only need to be included on a post once, if you have multiple formulas to show.

<script type="text/javascript" async="" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

<p><span class="math display">\[r_{xy}=\frac{\sum_{i=1}^{n}((x_i-\bar{x})(y_i-\bar{y}))}{\sqrt{\sum_{i=1}^{n}(x_i-\bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i-\bar{y})^2}}\]</span></p>

Further Reading