# How to write subequations for an equation

\documentclass[sfdefaults=false,12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
$$\label{latency} \min_{\alpha_i,\beta_i,l^{C}_{ij}}\sum^{M}_{i=1} \begin{bmatrix} \alpha_iy_i\frac{q_i}{l^{UE}_{i}} + & (1-\alpha_i)\frac{y_i}{r_{i,j}} + & \beta_iy_i\frac{q_i}{l^{C}_{ij}} + & (1-\alpha_i-\beta_i)\frac{y_i}{r_j} \end{bmatrix},$$
subject to
\begin{subequations}
$$\begin{matrix} C1: \sum^{M}_{i=1}l^{C}_{ij} \leq l^{C.\max}_{j} & \forall = 1,2,\dots,N. \\ \end{matrix}$$
$$\begin{matrix} C2: e^{UE}_{i} + e^{off}_{i} \leq E^{UE.\max}_{i} & \forall = 1,2,\dots,M. \\ \end{matrix}$$
$$\begin{matrix} C3: 0 \leq \alpha_i \leq 1 & \forall = 1,2,\dots,M. \\ \end{matrix}$$
$$\begin{matrix} C4: 0 \leq \beta_i \leq 1-\alpha_i & \forall = 1,2,\dots,M. \\ \end{matrix}$$
\end{subequations}
\end{document}


but the result is this

what I want is that to continue like 12a 12b 12c 12d not 13a 13b... and align C1-C4 to left and \forall.... to middle or just keeping the alignment with enough gap is enough for me. Can you help me please?

Use a single alignment environment. You can add \displaybreak where you need a page break, in extreme cases.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

\begin{subequations}\label{latency}
$$\tag{\ref{latency}} \min_{\alpha_i,\beta_i,l^{C}_{ij}}\sum^{M}_{i=1}\Bigl[ \alpha_iy_i\frac{q_i}{l^{UE}_{i}} + (1-\alpha_i)\frac{y_i}{r_{i,j}} + \beta_iy_i\frac{q_i}{l^{C}_{ij}} + (1-\alpha_i-\beta_i)\frac{y_i}{r_j} \Bigr],$$
subject to
\begin{alignat}{2}
\\
\\
\\

With the label to subequations you can use \tag for numbering the equation.
All matrix environments have disappeared; note that you don't need bmatrix in the first equation.
Quite likely, the superscript C, UE and off should be inside \mathrm. Also \forall should be followed by variables; personally, I'd write i,j=1,2,\dots,M avoiding \forall in the first case, i=1,2,\dots,M in the others.