# How to align group of mathematical expressions to the left?

Here are a group of mathematical expressions:

$$arg\ \underset{\theta}{max} \underset{n}{\prod}P(Y_n|\theta)$$
$$=arg\ \underset{\theta}{max} \underset{n}{\prod}\theta^{Y_n}(1-\theta)^{1-Y_n}$$
$$=arg\ \underset{\theta}{max} \sum log\theta^{Y_n}(1-\theta)^{1-Y_n}$$
$$=arg\ \underset{\theta}{max} \sum[Y_n log\theta + (1-Y_n)log(1-\theta)]$$
Optimizing problem:
$$=-arg\ \underset{\theta}{min} \sum[Y_n log\theta + (1-Y_n)log(1-\theta)]$$


I am trying to align them to the left. I tried putting them inside %\begin{align*} ... % \end{align*} without  signs. But no luck.

• @Troy I've tried it but it does not serve my purpose. – Dipto_Das Jun 3 '17 at 17:54
• Please describe your problem better, which code (MWE) did you tried, and what is still the problem, for example mark it in the screenshot added to your question ... – Mensch Jun 3 '17 at 18:08

Without a complete MWE, it's difficult to know what you're after, but I assume it's something like this:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\arg\ \underset{\theta}{\max} \underset{n}{\prod}P(Y_n|\theta) & =\arg\ \underset{\theta}{\max} \underset{n}{\prod}\theta^{Y_n}(1-\theta)^{1-Y_n} \\
& =\arg\ \underset{\theta}{\max} \sum \log\theta^{Y_n}(1-\theta)^{1-Y_n}           \\
& =\arg\ \underset{\theta}{\max} \sum[Y_n \log\theta + (1-Y_n)\log(1-\theta)]      \\
\intertext{Optimizing problem:}
& =-\arg\ \underset{\theta}{\min} \sum[Y_n \log\theta + (1-Y_n)\log(1-\theta)]     \\
\end{align*}
alternatively:
\begin{flalign*}
& \arg\ \underset{\theta}{\max} \underset{n}{\prod}P(Y_n|\theta) \\
& =\arg\ \underset{\theta}{\max} \underset{n}{\prod}\theta^{Y_n}(1-\theta)^{1-Y_n} \\
& =\arg\ \underset{\theta}{\max} \sum \log\theta^{Y_n}(1-\theta)^{1-Y_n}          \\
& =\arg\ \underset{\theta}{\max} \sum[Y_n \log\theta + (1-Y_n)\log(1-\theta)]     \\
\intertext{Optimizing problem:}
& =-\arg\ \underset{\theta}{\min} \sum[Y_n \log\theta + (1-Y_n)\log(1-\theta)]    \\
\end{flalign*}
\end{document}


alternatively, perhaps you'd like flalign:

• I do not want the first line to contain a = sign. – Dipto_Das Jun 3 '17 at 17:41
• @Dipto_Das if you provide a screenshot of your desired output, it'd be most helpful – cmhughes Jun 3 '17 at 18:05
• @Dipto_Das see my update – cmhughes Jun 4 '17 at 8:31

The following may be what you're looking for. Note the use of \arg, \max, \min, and \log to generate upright math-operator expressions. I've also replaced the two instances of \underset{n}{\prod} with \prod_n.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
& \arg\max_\theta \prod_n P(Y_n\mid\theta)\\
&=\arg\max_\theta \prod_n \theta^{Y_n}(1-\theta)^{1-Y_n}\\
&=\arg\max_\theta \sum \log\bigl(\theta^{Y_n}(1-\theta)^{1-Y_n}\bigr)\\
&=\arg\max_\theta \sum [Y_n \log\theta + (1-Y_n)\log(1-\theta)]\\
\intertext{Optimizing problem:}
&-\arg\min_\theta \sum[Y_n \log\theta + (1-Y_n)\log(1-\theta)]
\end{align*}
\end{document}

• Your code does what I want, but it places everything in the center of the page. I want them all to start from the left margin. How can I do that? – Dipto_Das Jun 3 '17 at 18:44
• @Dipto_Das - You could (a) switch from an align* environment to an flalign* environment and (b) add a & marker at the end of one of the math lines (but before the double line-break directive). E.g., change \prod_n P(Y_n\mid\theta) to \prod_n P(Y_n\mid\theta)&. – Mico Jun 3 '17 at 19:07