Making an align environment begin on the same line as the question label

\textbf{Question 2}

a)
\begin{align*}
P(a<\mu<b|\mathbf{y}) & = P(a<\mu|\mathbf{y}<b) \\
& = \int_{a}^b p(\mu|\mathbf{y}) d\mu  \ \ \text{where} \ \ p(\mu|\mathbf{y}) \ \ \text{is a Student \textit{t} pdf.} \\
& = \int_{\mu} I_{(a<\mu|\mathbf{y}<b)} p(\mu|\mathbf{y}) d\mu
\end{align*}
\begin{align*}
\text{where} \ \ I_{(a<\mu|\mathbf{y}<b)} = \begin{cases} 1 & \text{if} \ a<\mu|\mathbf{y}<b \\ 0 & \text{otherwise}  \end{cases}
\end{align*}


produces:

But I want it to look like:

ie, the first line of the align starts on the same line as a)

How can I adjust the code to do this?

• Possible duplictate of tex.stackexchange.com/questions/58141/… Aug 25 '13 at 18:48
• Off-topic hint: don't use | to denote the "given" or "conditional on" symbol. There's a command called \mid that inserts a vertical bar, but with thin spaces on either end. I think you'll like the resulting look.
– Mico
Aug 25 '13 at 19:39
• @Mico Thanks for that, I will start using it from now on :) Aug 25 '13 at 20:07

I believe you may want the aligned environment

% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{enumerate}
\item
\begin{aligned}[t] P(a<\mu<b|\mathbf{y}) & = P(a<\mu|\mathbf{y}<b) \\ & = \int_{a}^b p(\mu|\mathbf{y}) d\mu \ \ \text{where} \ \ p(\mu|\mathbf{y}) \ \ \text{is a Student \textit{t} pdf.} \\ & = \int_{\mu} I_{(a<\mu|\mathbf{y}<b)} p(\mu|\mathbf{y}) d\mu \end{aligned}
\end{enumerate}
\end{document}

• to the mods: would you prefer me to delete this and post it as an answer to Ruben's link? Aug 25 '13 at 19:10
• Can you explain what [t] in \begin{aligned}[t] means? May 26 '20 at 19:33
• I think of it as "top aligned", but texdoc amsmath will give you definitive May 26 '20 at 20:27
• How can we created the same with number equation May 27 '20 at 5:37