hello how can I write this equation in latex?
2 Answers
Here are two ways to typeset the equation in question. The first replicates the expression in the screenshot you posted. The second uses what I would consider to be a somewhat more standard way of expressing the idea that the minimization takes place over an index k
that belongs to the set of integers ranging from 1 to n.
\documentclass{article} % or some other suitable document class
\usepackage{amsmath} % for 'align*' environment
\usepackage{newtxtext,newtxmath} % optional (Times roman fonts)
\begin{document}
\begin{align*}
AB[i,j] &= \min\limits_{k=1}^n (A[i,k]+B[k,j]) \\
AB[i,j] &= \min\limits_{k\in\{1,\dots,n\}} (A[i,k]+B[k,j])
\end{align*}
\end{document}
-
2
An alternative for \min\limits_{k=1}^n
using \DeclareMathOperator*{\mlimi}{\min}
.
\documentclass[12pt]{article}
\usepackage{newtxtext,newtxmath}
\DeclareMathOperator*{\mlimi}{\min}
\begin{document}
\[AB[i,j]=\mlimi_{k=1}^n (A[i,k]+B[k,j])\]
\end{document}
It is possible to adjiust (decreasing) the upper and lower limits using \scriptscriptstyle
.
\documentclass[12pt]{article}
\usepackage{newtxtext,newtxmath}
\DeclareMathOperator*{\mlimi}{\min}
\begin{document}
\[AB[i,j]=\mlimi_{\scriptscriptstyle k=1}^{\scriptscriptstyle n} (A[i,k]+B[k,j])\]
\end{document}
k=1
andn
in the right location. If that was your problem and everything else was fine, it would have been helpful to say so when you posted your question.