Notation for the number of components in a vector?

1.8k Views Asked by At

Say I have a vector $\mathbf{\theta} = (1,2,3)'$. I'm looking for a way to write the number of components/coordinates in the vector. Something like $\dim(\mathbf{\theta}) = 3$. However, as I understand it, 'dim' is usually used to denote the dimensionality of the vector space of which $\mathbf{\theta}$ is an element, so 'dim' seems clumsy.

Is there an established convention for this? For context, $\mathbf{\theta}$ is a parameter vector for a model.

3

There are 3 best solutions below

0
On BEST ANSWER

There is no standard notation for this.

I think $\dim \theta$ should be clear enough from the context, should you really need a notation.

0
On

The question is ill posed (slightly)

A vector does not, a priori, have innate "components" or "coordinates". Roughly speaking, a vector is "just" an element of a vector space $V$ over some field $k$ (which can be defined axiomatically; it isn't important here). It can be shown that every vector space has a maximal linearly independent subset, which forms a basis for that space. Suppose that $\{ e_j \}$ is such a set. Then if $v \in V$, there exists a set of coefficients $\{ a_j \}\subseteq k$ such that $$ v = \sum a_j e_j $$ (that is, $v$ may be written as a (possibly infinite) linear combination of the $e_j$). To simplify notation, if $\{e_j\}$ is finite and contains $n$ elements, we often write something like $$ v = \langle a_1, a_2, \dotsc, a_n\rangle. $$ This is a shorthand notation for the sum above. In this setting, the $j$-th "component" or "coordinate" of a vector $v$ is the coefficient of the $j$-th basis element in the linear combination of basis vectors which gives $v$. Note also that the cardinality of the basis ($n$, above), is the dimension of the space.

What not to do (maybe)

I disagree (mildly) with lhf's answer, in which it is asserted that if $v$ is a vector, then $\dim v$ should be understood. lhf is not wrong—if you clearly define this notation early on, you can likely use it without causing confusion. However, I think that this notation is unaesthetic, as it overloads the notation $\dim$. It also assigns to a vector a property which it doesn't have, i.e. a dimension. Personally, I would avoid this abuse of notation (though, again, this is my opinion on aesthetics, so your milage may vary).

What to do instead

I think that the most common approach is the set things up so that determining the length of a vector is unnecessary. For example, if we are working in finite dimensional vector spaces over $\mathbb{R}$, then our vectors are elements of $\mathbb{R}^n$ for some $n$. Just use $n$ to denote the length. That is, if $v \in \mathbb{R}^n$, then the object asked for in the original question is just "$n$".

Finally, if one really, really needs a notation for the length of a vector, I would suggest $\ell(v)$. In $\LaTeX$, this is typeset with \ell(v).

0
On
  1. The conventional way is to define the length beforehand:

    Let $\mathbb{v} \in \mathbb{R}^N$. Then, $$\| \mathbb{v} \|^2 = \sum_{n=1}^N {v_n}^2.$$

  2. If defining the length beforehand is inconvenient, just create a function length or len:

    $$\| \mathbb{v} \|^2 = \sum_{n=1}^{\operatorname{length}(\mathbb{v})} {v_n}^2.$$

  3. Another function name is $\ell$, as proposed by @XanderHenderson. But you should clarify what it means within the text:

    $$\| \mathbb{v} \|^2 = \sum_{n=1}^{\ell(\mathbb{v})} {v_n}^2,$$ where $\ell(\mathbb{v})$ denotes the length of $\mathbb{v}$.