This question is a bit related to the answer provided here: How can I use an align environment flush left?
I use algorithm2e and mathtools to write an algorithm with an equation inside. I want it to be on the left side. Why I have to add additional & (space after it added for clarity) at the beginning of a line when without algorithm environment I didn't have to?
MWE:
\documentclass{article}
\usepackage{mathtools}
\usepackage[ruled,vlined]{algorithm2e}
\begin{document}
\begin{algorithm}
\begin{flalign}
& \mu_\beta \leftarrow \frac{1}{m} \sum_{i=1}^{m}{x_1}&
\end{flalign}
\end{algorithm}
\end{document}

\documentclass{...}and ending with\end{document}instead of a code snippet. This makes our lives easier and increases the chance of people helping you. – campa Feb 25 '21 at 13:54