Math & Sciencepiecewise function

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
willy0625
Posts: 3
Joined: Mon Apr 05, 2010 7:11 am

piecewise function

Post by willy0625 »

For the following piecewise function


f(x)= \left\{ \begin{array}{lr} 1 - e^{-(c\lambda)x}& \text{if }X\text{ is exponential} \\1-(1-p_{X})^{cx} &\text{if }X\text{ is geometric}. \end{array} \right

I am trying to align "if X is exponential" and "if X is geometric".

Cheers.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

piecewise function

Post by gmedina »

Hi,

you could use the cases environment provided by the amsmath package:

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
  f(x)=% 
  \begin{cases}
    1 - e^{-(c\lambda)x} &\text{if $X$ is exponential} \\
    1-(1-p_{X})^{cx} &\text{if $X$ is geometric}.
  \end{cases}
\end{equation}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply