Math & ScienceAlignment for split Equation

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
ankitravankar
Posts: 10
Joined: Mon Jun 18, 2012 10:06 am

Alignment for split Equation

Post by ankitravankar »

I want to write few equations one under the other. I am using the split environment to align them properly. However the equations are either getting to far left or far right side of the page on compiling. How to put these equations in center?

here is the code i used

Code: Select all

\begin{equation}
\begin{split}
\frac{\partial }{\partial c_k}SSE& =\frac{\partial }{\partial c_k}\sum_{i=1}^{K}\sum_{x\epsilon C_i }(c_i-x)^2\\
						&=\sum_{i=1}^{K}\sum_{x\epsilon C_i }\frac{\partial }{\partial c_k}(c_i-x)^2\\
						&=\sum_{x\epsilon C_k }2\ast (c_k-x_k)=0\\		
		\sum_{x\epsilon C_k }2\ast (c_k-x_k)=0\Rightarrow m_kc_k=\sum_{x\epsilon C_k }x_k=c_k=\frac{1}{m_k}\sum_{x\epsilon C_k }x_k
\end{split}
\end{equation}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Alignment for split Equation

Post by Stefan Kottwitz »

Hi Ankitravankar,

welcome to the board!

There's just an alignment point missing in the last line, so the whole last line will be in the first alignment column, which pushes the right column to the right. Simply place an & symbol where you would like to align, such as:

Code: Select all

\sum_{x\epsilon C_k }2\ast (c_k-x_k)=0&\Rightarrow m_kc_k=
\sum_{x\epsilon C_k }x_k=c_k=\frac{1}{m_k}\sum_{x\epsilon C_k }x_k
Stefan
LaTeX.org admin
ankitravankar
Posts: 10
Joined: Mon Jun 18, 2012 10:06 am

Re: Alignment for split Equation

Post by ankitravankar »

Thanks a lot Stefan_K.. that helped ...
Post Reply