How Weights Change a Vector’s Length
The ordinary Euclidean length of a vector gives each coordinate the same role: the squares of the coordinates are added, and the square root is taken. A positive weighted dot product changes that calculation by assigning a positive weight to each coordinate. A coordinate with a larger weight contributes more to the squared length, while one with a smaller weight contributes less. These calculations are useful whenever the coordinates are not meant to contribute equally, but the weights must be included in the right place.
Throughout this tutorial, vectors are columns in \(\mathbb{R}^n\). Let \(w_1,\dots,w_n\) be positive real numbers. The associated weighted dot product is defined by weighting the products of corresponding coordinates. Its induced norm is the square root of the weighted dot product of a vector with itself. We will write \(\|\mathbf{x}\|_w\) for this weighted length, and \(\|\mathbf{x}\|\) for the ordinary Euclidean length.
Because every \(w_i\) is positive, each term \(w_i x_i^2\) is nonnegative. The weighted length is therefore real and is zero exactly when every coordinate is zero. The weights multiply the coordinate squares; they do not replace the coordinates before the entire expression is squared. This distinction is important in both hand calculations and matrix notation.
Diagonal-Matrix Calculation
Place the weights on the diagonal of a matrix \(\mathbf{D}=\operatorname{diag}(w_1,\dots,w_n)\). For example, when \(n=3\), \(\mathbf{D}=\begin{bmatrix}w_1&0&0\\0&w_2&0\\0&0&w_3\end{bmatrix}\). Since \(\mathbf{D}\mathbf{y}\) has entries \(w_1y_1,\dots,w_ny_n\), multiplying on the left by \(\mathbf{x}^{\top}\) gives \(\mathbf{x}^{\top}\mathbf{D}\mathbf{y}=\sum_{i=1}^n w_ix_iy_i\). Thus the weighted dot product can be computed either coordinate by coordinate or by a matrix product.
Worked Example: A Three-Coordinate Weighted Length
Calculate the weighted length of \(\mathbf{x}=\begin{bmatrix}2\\-1\\1\end{bmatrix}\) when the weights are \(1,4,9\), and compare it with the ordinary Euclidean length.
The weighted dot product has matrix \(\mathbf{D}=\begin{bmatrix}1&0&0\\0&4&0\\0&0&9\end{bmatrix}\). First compute the weighted squared length by coordinates:
Therefore \(\|\mathbf{x}\|_w=\sqrt{17}\). The matrix calculation gives the same result: \(\mathbf{D}\mathbf{x}=\begin{bmatrix}2\\-4\\9\end{bmatrix}\), so \(\mathbf{x}^{\top}\mathbf{D}\mathbf{x}=\begin{bmatrix}2&-1&1\end{bmatrix}\begin{bmatrix}2\\-4\\9\end{bmatrix}=4+4+9=17\). For the ordinary Euclidean length, each coordinate has weight \(1\), so \(\|\mathbf{x}\|^2=2^2+(-1)^2+1^2=6\), and \(\|\mathbf{x}\|=\sqrt{6}\).
Check: Squaring the proposed weighted length gives \((\sqrt{17})^2=17\), which agrees with both the coordinate calculation and the matrix product. The ordinary squared length is \(6\), so the two lengths differ.
The weighted and ordinary lengths need not be close, even for the same vector. In this example, the third coordinate has weight \(9\), so its contribution is \(9\) rather than \(1\). The first coordinate contributes \(4\) in either calculation because its weight is \(1\); the second coordinate contributes \(4\) rather than \(1\). The change in length comes from changing the squared contributions before taking the square root.
Coordinate Scaling Explains the Formula
A weighted length can also be viewed as an ordinary Euclidean length after rescaling the coordinates. This gives a useful way to understand the calculation: multiplying coordinate \(i\) by \(\sqrt{w_i}\) makes its square contribute \(w_i x_i^2\). Let \(\mathbf{D}^{1/2}\) be the diagonal matrix with entries \(\sqrt{w_1},\dots,\sqrt{w_n}\).
Proof. The \(i\)th coordinate of \(\mathbf{D}^{1/2}\mathbf{x}\) is \(\sqrt{w_i}x_i\). By the definition of the ordinary Euclidean norm, $$ \|\mathbf{D}^{1/2}\mathbf{x}\| =\sqrt{\sum_{i=1}^{n}(\sqrt{w_i}x_i)^2} =\sqrt{\sum_{i=1}^{n}w_i x_i^2} =\|\mathbf{x}\|_w. $$ The equalities use \(w_i>0\), so that \((\sqrt{w_i})^2=w_i\). This proves the claimed identity for every \(\mathbf{x}\in\mathbb{R}^n\). \(\square\)
This identity is a computational equivalence, not a claim that the original coordinates have changed. It says that one can obtain the weighted length by applying a diagonal scaling and then using the ordinary length formula. In the previous example, \(\mathbf{D}^{1/2}=\begin{bmatrix}1&0&0\\0&2&0\\0&0&3\end{bmatrix}\), and the scaled vector is \(\begin{bmatrix}2\\-2\\3\end{bmatrix}\). Its ordinary squared length is \(2^2+(-2)^2+3^2=17\), as required.
Worked Example: Fractional and Unequal Weights
Let \(\mathbf{y}=\begin{bmatrix}2\\-2\\1\end{bmatrix}\), with weights \(\tfrac14,2,3\). Calculate its weighted and ordinary lengths.
Using the weighted formula, the three contributions to the squared length are \(\tfrac14(2^2)=1\), \(2((-2)^2)=8\), and \(3(1^2)=3\). Hence \(\|\mathbf{y}\|_w^2=1+8+3=12\), so \(\|\mathbf{y}\|_w=\sqrt{12}=2\sqrt{3}\).
For a scaling check, the square roots of the weights are \(\tfrac12,\sqrt{2},\sqrt{3}\). Thus the scaled vector is \(\mathbf{D}^{1/2}\mathbf{y}=\begin{bmatrix}1\\-2\sqrt{2}\\\sqrt{3}\end{bmatrix}\), and its ordinary squared length is \(1^2+(-2\sqrt{2})^2+(\sqrt{3})^2=1+8+3=12\). The ordinary Euclidean squared length of the original vector is \(2^2+(-2)^2+1^2=9\), so its ordinary length is \(3\).
Check: The proposed weighted length satisfies \((2\sqrt{3})^2=12\), matching both the weighted coordinate sum and the ordinary squared length after scaling. The ordinary length satisfies \(3^2=9\), matching the unweighted coordinate sum.
Bounds from the Smallest and Largest Weights
Instead of calculating every weighted contribution, it can be useful to know in advance how far the weighted length can differ from the ordinary one. Let \(m\) be the smallest weight and \(M\) the largest weight. Since every weight lies between these two values, each term \(w_ix_i^2\) lies between \(mx_i^2\) and \(Mx_i^2\). Adding these inequalities produces bounds on the whole squared length, and taking nonnegative square roots gives bounds on the length.
Proof. The definitions of \(m\) and \(M\) give \(m\leq w_i\leq M\) for each \(i\). Since \(x_i^2\geq0\), multiplying by \(x_i^2\) preserves the inequalities: \(mx_i^2\leq w_ix_i^2\leq Mx_i^2\). Summing over all coordinates yields $$ m\sum_{i=1}^{n}x_i^2 \leq \sum_{i=1}^{n}w_ix_i^2 \leq M\sum_{i=1}^{n}x_i^2. $$ Both sides are nonnegative. Taking nonnegative square roots preserves their order, and the definitions of the two norms give \(\sqrt{m}\,\|\mathbf{x}\|\leq\|\mathbf{x}\|_w\leq\sqrt{M}\,\|\mathbf{x}\|\). This also covers \(\mathbf{x}=\mathbf{0}\), since each expression is then zero. \(\square\)
Worked Example: Applying the Weight Bounds
For \(\mathbf{z}=\begin{bmatrix}1\\2\\-2\end{bmatrix}\) and weights \(1,4,9\), use the bounds theorem and then calculate the exact weighted length.
The smallest weight is \(m=1\), and the largest is \(M=9\). The ordinary squared length is \(1^2+2^2+(-2)^2=1+4+4=9\), so \(\|\mathbf{z}\|=3\). The theorem gives \(\sqrt{1}\cdot3\leq\|\mathbf{z}\|_w\leq\sqrt{9}\cdot3\), or \(3\leq\|\mathbf{z}\|_w\leq9\).
Now calculate directly: $$ \|\mathbf{z}\|_w^2 =1(1^2)+4(2^2)+9((-2)^2) =1+16+36 =53. $$ Therefore \(\|\mathbf{z}\|_w=\sqrt{53}\). Since \(49<53<81\), we have \(7<\sqrt{53}<9\), which is consistent with the theorem’s bounds.
Check: Squaring the calculated length gives \((\sqrt{53})^2=53\), the weighted sum. Also \(3\leq\sqrt{53}\leq9\), as required by the bound.
The bounds are guaranteed for every vector, but they need not be exact for a particular vector. Equality at the lower bound occurs when all nonzero coordinates of the vector are attached to weights equal to \(m\); equality at the upper bound occurs when all its nonzero coordinates are attached to weights equal to \(M\). To verify the lower-bound statement, if each nonzero coordinate has weight \(m\), then \(\sum_iw_ix_i^2=m\sum_ix_i^2\), so the squared lengths, and hence the nonnegative lengths, agree. The upper-bound statement follows by the same calculation with \(M\). If all weights are equal to a single positive number \(c\), then the formula simplifies for every vector to \(\|\mathbf{x}\|_w=\sqrt{c}\,\|\mathbf{x}\|\).
Common Mistake: Weighting the Wrong Quantity
For \(\mathbf{x}=\begin{bmatrix}2\\-1\\1\end{bmatrix}\) and weights \(1,4,9\), a tempting but incorrect calculation is \(\sqrt{1|2|+4|-1|+9|1|}=\sqrt{15}\). This uses absolute values of the coordinates and weights them before summing. The definition instead weights the squares of the coordinates: the correct squared length is \(1(2^2)+4((-1)^2)+9(1^2)=4+4+9=17\), so the correct length is \(\sqrt{17}\).
A related error is to multiply each coordinate by its weight and then square, which would give \(1^2(2^2)+4^2((-1)^2)+9^2(1^2)\). That calculation squares the weights as well as the coordinates, producing \(4+16+81=101\), not \(17\). The scaling method avoids this error by multiplying coordinates by \(\sqrt{w_i}\), not by \(w_i\).
Choosing a Calculation Method
For a small number of coordinates, summing \(w_ix_i^2\) is usually the quickest method. The diagonal-matrix form is convenient when the weights are already given as a matrix or when several weighted dot products use the same weights. Coordinate scaling is a useful independent check, particularly when the weights are perfect squares or have simple square roots. The bounds are most useful when an estimate is sufficient or when a calculation needs to be checked for plausibility.
| Method | Calculation | Useful when |
|---|---|---|
| Coordinate formula | \(\|\mathbf{x}\|_w^2=\sum_iw_ix_i^2\) | The vector and weights have few coordinates |
| Diagonal matrix | \(\|\mathbf{x}\|_w^2=\mathbf{x}^{\top}\mathbf{D}\mathbf{x}\) | The weights are supplied in matrix form |
| Coordinate scaling | \(\|\mathbf{x}\|_w=\|\mathbf{D}^{1/2}\mathbf{x}\|\) | A separate check or geometric interpretation is helpful |
| Weight bounds | \(\sqrt m\|\mathbf{x}\|\leq\|\mathbf{x}\|_w\leq\sqrt M\|\mathbf{x}\|\) | An estimate is enough, or an answer needs a range check |
In every method, the weights must be positive as specified. The direct sum still has a numerical value if a weight is zero or negative, but the positivity assumptions used for a weighted inner product and the bounds above would no longer be satisfied. For this topic, keep the setting fixed: positive weights, real coordinates, and a length obtained as the nonnegative square root of the weighted sum of coordinate squares.
Check Your Understanding
For each question, use the weighted squared-length formula first, and then check the result using scaling or the weight bounds where appropriate.
- For \(\mathbf{v}=\begin{bmatrix}1\\-3\end{bmatrix}\) with weights \(4\) and \(1\), calculate the weighted length and the ordinary Euclidean length.
- Write the diagonal matrix for weights \(2,\tfrac14,5\), and calculate the weighted squared length of \(\begin{bmatrix}2\\2\\-1\end{bmatrix}\).
- For weights \(3,7\), state the smallest-weight and largest-weight bounds for the weighted length of \(\begin{bmatrix}1\\2\end{bmatrix}\).
- Explain why scaling coordinate \(i\) by \(\sqrt{w_i}\), rather than \(w_i\), gives the weighted length as an ordinary Euclidean length.
- For which positive weights does the weighted length equal the ordinary Euclidean length for every vector?