# Latex Code for Uniform Distribution PDF

The following is Probabiliy Density Function (PDF) of uniform distribution.

$f(x) = \left\{ \begin{array}{rcl} \frac{1}{b-a} & \mbox{for} & a \le x \le b\\ 0 & \mbox{for} & x < a \ or \ x>b \end{array}\right.$

Below includes tutorials showing how to write it as Latex code. Further, this tutorial also shows how you can write it in Markdown and WordPress.

## Latex Code for Uniform Distribution PDF

The following is the Latex code for correlation formula.

f(x) = \left\{ \begin{array}{rcl} \frac{1}{b-a} & \mbox{for} & a \le x \le b\\ 0 & \mbox{for} & x < a \ or \ x>b \end{array}\right.

## Add Latex Code in Markdown

If you want to show the formula above in R Markdown or Jupyter Markdown, you can use the following. The only difference is to add the dollar sign, namely $, on both ends. $f(x) = \left\{ \begin{array}{rcl} \frac{1}{b-a} & \mbox{for} & a \le x \le b\\ 0 & \mbox{for} & x < a \ or \ x>b \end{array}\right.\$


## Show Uniform Distribution PDF in WordPress

To show Latex formulas 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, if you have multiple formulas within a same post, the Javascript part only needs to be included in the post once.

<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">$f(x) = \left\{ \begin{array}{rcl} \frac{1}{b-a} & \mbox{for} & a \le x \le b\\ 0 & \mbox{for} & x < a \ or \ x>b \end{array}\right.$</span></p>