One of my constraints in an optimization problem involves using canonical basis vector for the n-dimensional space.
How do I precisely write $j^{th}$ canonical basis vector for the n-dimensional space as a vector.
Normally its like
$n\times 1$ vector $\mathbf{e}_j$ is
\begin{gather*} \mathbf{e}_j=\begin{cases} 1 & \text{, } i=j\\ 0 & \text{, } i\neq j\\ \end{cases} \end{gather*}
and $1\leq j\leq n$.
I think what you’ve already written basically suffices, but to be a bit clearer you could say:
Assuming you’re working in the real numbers...
The $j^{th}$ canonical basis vector $\mathbf{e}_j$ = $\begin{pmatrix}a_1\\a_2\\\vdots\\a_n\end{pmatrix} \in \mathbb{R}^n$ where $a_i = 1$ if $i = j$ and $0$ otherwise.