Tutorials › Linear Algebra › Weighted Dot Products With Positive Weights

Inner Products and Norms · Tutorial 598 of 1000

Weighted Dot Products With Positive Weights

Learn to test and compute weighted dot products, and see how positive weights rescale coordinates while preserving the real inner product axioms.

Intermediate 9 min read

What You'll Learn

  • Define a weighted dot product on \(\mathbb{R}^n\) using strictly positive coordinate weights.
  • Prove that positive weights give symmetry, bilinearity, and positive definiteness.
  • Explain why zero or negative weights cannot define an inner product of this form.
  • Compute weighted inner products and the associated lengths.
  • Relate weighted products to the standard dot product after coordinate scaling.
  • Identify when changing weights changes which vectors are orthogonal.

Why Weight the Coordinates?

The standard dot product gives each coordinate an equal contribution. In some settings, however, one coordinate should contribute more to a measured length or interaction than another. Positive weights provide a direct way to adjust those contributions: a large weight makes a coordinate count more, while a small positive weight makes it count less. The key condition is that every weight must be strictly positive. This is what ensures the resulting product still satisfies the real inner product axioms.

We work over \(\mathbb{R}\). Recall that a real inner product on \(\mathbb{R}^n\) is a function \(\langle\cdot,\cdot\rangle:\mathbb{R}^n\times\mathbb{R}^n\to\mathbb{R}\) that is linear in each argument, symmetric, and positive definite. Positive definiteness means \(\langle\mathbf{x},\mathbf{x}\rangle>0\) whenever \(\mathbf{x}\ne\mathbf{0}\), and \(\langle\mathbf{0},\mathbf{0}\rangle=0\).

Definition: Let \(w_1,\dots,w_n\) be strictly positive real numbers. For \(\mathbf{x}=(x_1,\dots,x_n)^\top\) and \(\mathbf{y}=(y_1,\dots,y_n)^\top\) in \(\mathbb{R}^n\), the weighted dot product with weights \(w_1,\dots,w_n\) is \(\langle\mathbf{x},\mathbf{y}\rangle_w=\sum_{i=1}^n w_i x_i y_i\). The associated length is \(\|\mathbf{x}\|_w=\sqrt{\langle\mathbf{x},\mathbf{x}\rangle_w}\).

The subscript \(w\) indicates that this product need not be the standard dot product. In particular, the weight on coordinate \(i\) multiplies that coordinate's contribution \(x_i y_i\). The corresponding squared length is \(\sum_{i=1}^n w_i x_i^2\), so each coordinate contributes a nonnegative amount, and a nonzero coordinate contributes a strictly positive amount.

Why Strictly Positive Weights Give an Inner Product

Theorem: For real weights \(w_1,\dots,w_n\), the formula \(\langle\mathbf{x},\mathbf{y}\rangle_w=\sum_{i=1}^n w_i x_i y_i\) defines a real inner product on \(\mathbb{R}^n\) if and only if \(w_i>0\) for every \(i\).

Proof. First suppose every \(w_i>0\). For any \(\mathbf{x},\mathbf{y}\in\mathbb{R}^n\), commutativity of real multiplication gives \(\langle\mathbf{x},\mathbf{y}\rangle_w=\sum_{i=1}^n w_i x_i y_i=\sum_{i=1}^n w_i y_i x_i=\langle\mathbf{y},\mathbf{x}\rangle_w\), so the product is symmetric.

For any \(\mathbf{x},\mathbf{y},\mathbf{z}\in\mathbb{R}^n\) and \(a,b\in\mathbb{R}\), the \(i\)th coordinate of \(a\mathbf{x}+b\mathbf{y}\) is \(ax_i+by_i\). Therefore \(\langle a\mathbf{x}+b\mathbf{y},\mathbf{z}\rangle_w=\sum_{i=1}^n w_i(ax_i+by_i)z_i=a\sum_{i=1}^n w_i x_i z_i+b\sum_{i=1}^n w_i y_i z_i=a\langle\mathbf{x},\mathbf{z}\rangle_w+b\langle\mathbf{y},\mathbf{z}\rangle_w\). By symmetry, linearity in the first argument also gives linearity in the second: \(\langle\mathbf{z},a\mathbf{x}+b\mathbf{y}\rangle_w=a\langle\mathbf{z},\mathbf{x}\rangle_w+b\langle\mathbf{z},\mathbf{y}\rangle_w\).

Finally, \(\langle\mathbf{x},\mathbf{x}\rangle_w=\sum_{i=1}^n w_i x_i^2\). Each term is nonnegative. If \(\mathbf{x}\ne\mathbf{0}\), at least one coordinate \(x_j\ne0\), so \(w_jx_j^2>0\), and hence the whole sum is strictly positive. If \(\mathbf{x}=\mathbf{0}\), every term is zero. Thus the product is positive definite and satisfies all the real inner product axioms.

For the reverse implication, suppose the formula defines an inner product. For each standard basis vector \(\mathbf{e}_i\), its \(i\)th coordinate is \(1\) and all other coordinates are \(0\), so \(\langle\mathbf{e}_i,\mathbf{e}_i\rangle_w=w_i\). Since \(\mathbf{e}_i\ne\mathbf{0}\), positive definiteness requires \(w_i>0\). This holds for every \(i\), proving the necessity as well as the sufficiency. \(\square\)

This argument checks the axioms directly; it does not depend on a special choice of dimension. The weights may differ, but they cannot vanish or be negative if the formula is to define an inner product.

Computing Weighted Products and Lengths

Worked Example: A Weighted Product and Two Lengths

Use weights \(w_1=2\), \(w_2=5\) for \(\mathbf{x}=(1,2)^\top\) and \(\mathbf{y}=(3,-1)^\top\). Compute their weighted product and each associated length.

Multiply coordinate by coordinate, including the corresponding weight in each term:

$$ \langle\mathbf{x},\mathbf{y}\rangle_w =2(1)(3)+5(2)(-1) =6-10 =-4. $$

For the length of \(\mathbf{x}\), first compute its weighted squared length and then take the nonnegative square root:

$$ \langle\mathbf{x},\mathbf{x}\rangle_w =2(1)^2+5(2)^2 =2+20 =22, \qquad \|\mathbf{x}\|_w=\sqrt{22}. $$

For \(\mathbf{y}\), the calculation is

$$ \langle\mathbf{y},\mathbf{y}\rangle_w =2(3)^2+5(-1)^2 =18+5 =23, \qquad \|\mathbf{y}\|_w=\sqrt{23}. $$

Check: Reversing the arguments gives \(2(3)(1)+5(-1)(2)=6-10=-4\), agreeing with symmetry. Both squared lengths are positive, as required for these nonzero vectors.

Weights can change lengths even when the vector itself has not changed. For example, \((1,2)^\top\) has standard squared length \(1^2+2^2=5\), but its squared length with weights \(2\) and \(5\) is \(22\). The difference comes from changing how strongly each coordinate contributes; it is not a change to the vector's coordinates.

Positive Weights as Coordinate Rescaling

There is another way to interpret the weighted product. Since each \(w_i>0\), its positive square root \(\sqrt{w_i}\) is a real number. Rescale coordinate \(i\) by this factor. The weighted product then becomes an ordinary dot product of the rescaled vectors.

Theorem: Let \(w_1,\dots,w_n>0\), and define \(D=\operatorname{diag}(\sqrt{w_1},\dots,\sqrt{w_n})\), the diagonal matrix with these entries on its diagonal. For all \(\mathbf{x},\mathbf{y}\in\mathbb{R}^n\), \(\langle\mathbf{x},\mathbf{y}\rangle_w=(D\mathbf{x})^\top(D\mathbf{y})\).

Proof. Multiplication by \(D\) scales coordinate \(i\) of \(\mathbf{x}\) to \(\sqrt{w_i}x_i\), and coordinate \(i\) of \(\mathbf{y}\) to \(\sqrt{w_i}y_i\). By the definition of the standard dot product, \((D\mathbf{x})^\top(D\mathbf{y})=\sum_{i=1}^n(\sqrt{w_i}x_i)(\sqrt{w_i}y_i)=\sum_{i=1}^n w_i x_i y_i=\langle\mathbf{x},\mathbf{y}\rangle_w\). The middle equality uses \((\sqrt{w_i})^2=w_i\), which holds because \(w_i>0\). \(\square\)

The scaling viewpoint explains why positivity matters geometrically. A strictly positive scale changes the size of a coordinate without erasing or reversing it. If every coordinate is scaled this way, a nonzero vector remains nonzero. A zero weight would erase a coordinate entirely, while a negative weight would not have a real square root and would make the corresponding basis vector have negative squared length.

Worked Example: Checking a Product by Rescaling

Take weights \(w_1=4\), \(w_2=9\), with \(\mathbf{x}=(1,-2)^\top\) and \(\mathbf{y}=(3,1)^\top\). Compute the weighted product directly and by coordinate rescaling.

Directly from the definition,

$$ \langle\mathbf{x},\mathbf{y}\rangle_w =4(1)(3)+9(-2)(1) =12-18 =-6. $$

Here \(D=\begin{bmatrix}2&0\\0&3\end{bmatrix}\), since \(\sqrt{4}=2\) and \(\sqrt{9}=3\). Thus

$$ D\mathbf{x} = \begin{bmatrix}2&0\\0&3\end{bmatrix} \begin{bmatrix}1\\-2\end{bmatrix} = \begin{bmatrix}2\\-6\end{bmatrix}, \qquad D\mathbf{y} = \begin{bmatrix}2&0\\0&3\end{bmatrix} \begin{bmatrix}3\\1\end{bmatrix} = \begin{bmatrix}6\\3\end{bmatrix}. $$

The standard dot product of these rescaled vectors is \(2(6)+(-6)(3)=12-18=-6\), matching the direct result.

Check: The squared weighted length of \(\mathbf{x}\) is \(4(1)^2+9(-2)^2=4+36=40\). The squared length of \(D\mathbf{x}=(2,-6)^\top\) using the standard dot product is \(2^2+(-6)^2=4+36=40\). The length calculation agrees with the rescaling formula too.

Weights Can Change Orthogonality

Two vectors are orthogonal with respect to a given inner product when their product is zero. Changing the weights can therefore change which pairs are orthogonal. In particular, weighted orthogonality need not match orthogonality under the standard dot product: each product uses a different rule for combining coordinate contributions.

Worked Example: Orthogonal Under One Product, Not Another

Use weights \(w_1=1\), \(w_2=4\), and consider \(\mathbf{u}=(2,1)^\top\) and \(\mathbf{v}=(4,-2)^\top\). Test orthogonality with the weighted product, then compare with the standard dot product.

For the weighted product,

$$ \langle\mathbf{u},\mathbf{v}\rangle_w =1(2)(4)+4(1)(-2) =8-8 =0. $$

Thus the vectors are orthogonal under these weights. Their standard dot product, by contrast, is

$$ \mathbf{u}^{\top}\mathbf{v} =(2)(4)+(1)(-2) =8-2 =6. $$

Check: The weighted squared lengths are \(\langle\mathbf{u},\mathbf{u}\rangle_w=1(2)^2+4(1)^2=4+4=8\) and \(\langle\mathbf{v},\mathbf{v}\rangle_w=1(4)^2+4(-2)^2=16+16=32\). Both are positive, and the weighted product calculation gives zero exactly.

In applications, weights can represent different units, priorities, or measurement scales across coordinates. A weighted product is useful only when those weights are chosen consistently with the intended geometry. For instance, calling two vectors orthogonal without specifying which product is being used can give an incomplete description.

Common Pitfall: Nonnegative Is Not Enough

A zero weight can destroy positive definiteness. It may seem sufficient to require that weights are nonnegative, since then every term \(w_i x_i^2\) is nonnegative. But an inner product requires a strictly positive self-product for every nonzero vector. With weights \(w_1=1\), \(w_2=0\), the nonzero vector \(\mathbf{x}=(0,1)^\top\) gives the incorrect conclusion that this formula defines an inner product merely because its terms are nonnegative. In fact,

$$ \langle\mathbf{x},\mathbf{x}\rangle_w =1(0)^2+0(1)^2 =0, \qquad \mathbf{x}\ne\mathbf{0}. $$

This violates positive definiteness. The correction is to require \(w_i>0\) for every coordinate, not just \(w_i\ge0\). A negative weight fails as well: if \(w_j<0\), then \(\langle\mathbf{e}_j,\mathbf{e}_j\rangle_w=w_j<0\), which also violates positive definiteness.

When calculating, another practical safeguard is to keep each weight paired with its own coordinate product: the \(i\)th term must be \(w_i x_i y_i\). After computing, check symmetry by reversing the vectors, and check a claimed length by evaluating the self-product. These checks follow directly from the axioms and can expose a misplaced weight or sign error.

Check Your Understanding

Use the definitions and results above to justify each answer.

  1. For weights \(w_1=3\), \(w_2=2\), compute \(\langle(1,-1)^\top,(2,4)^\top\rangle_w\) and the weighted length of \((1,-1)^\top\).
  2. Why does a negative weight prevent the formula from being an inner product? State a vector that demonstrates the failure.
  3. For weights \(1\) and \(3\), are \((1,1)^\top\) and \((3,-1)^\top\) orthogonal under the weighted product? What is their standard dot product?
  4. Write the diagonal scaling matrix \(D\) for weights \(w_1=9\), \(w_2=4\), \(w_3=1\), and state how it transforms the weighted product.
  5. Explain why weights that are all nonnegative but include a zero do not satisfy the positive-definiteness axiom.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon