LaTeX – Case equation with a curly brace

This note will teach us how to write mathematical equations with a curly brace, specifically when writing articles in an inline mode on microblogging sites.

Case equation with a curly brace in LateX:

Example 1: Probability equation

These equations are required when we represent a function with multiple use cases. For example, to define probability of the events.

  • cases keyword creates a curly brace
  • ampersand (&) symbol bring equal spacing
  • double backslash act as new line with the curly brace
f(\omega) = \begin{cases} 1, & \text{if } \omega \text{ is Head} \\ 0, & \text{if } \omega \text{ is Tail} \end{cases}

 f(\omega) = \begin{cases} 1, & \text{if } \omega \text{ is Head} \\ 0, & \text{if } \omega \text{ is Tail} \end{cases}

Example 2: Probability function

In this example, we will show how to case equation with a curly brace in LateX for a random variable X which is equally likely to take each integer value in the range 1,2,3,4,\cdots, n.

P_X(x) = \begin{cases} 1/n, & x = 1,2,3,4, \cdots, n \\ 0, & \text{elsewhere.} \end{cases}

 P_X(x) = \begin{cases} 1/n, & x = 1,2,3,4, \cdots, n \\ 0, & \text{elsewhere.} \end{cases}

Example 3: Cumulative distribution function

In this example, we will show how to case equation with a curly brace in LaTeX to write a cumulative distribution function of a random variable X which is equally likely to take each integer value in the range 1,2,3,4,\cdots, n.

F_X(x) = \begin{cases} 0 & x < 1, \\ [x]/n, & 1 \leq x \leq n, \\ 1, & x \geq n, \end{cases}

 F_X(x) = \begin{cases} 0 & x < 1, \\ [x]/n, & 1 \leq x \leq n, \\ 1, & x \geq n, \end{cases}

References

 2,816 total views,  1 views today

Scroll to Top
Scroll to Top