Signals to learning / 1. Read the signal

Lesson 3 of 40 · Beginner · About 20 minutes

Vectors and similarity

How does a list of numbers become a geometric object?

You will be able to

  • Calculate a dot product and a vector norm.
  • Distinguish magnitude-sensitive dot products from cosine similarity.

Coordinates and weighted sums

A vector is an ordered collection of coordinates. Each coordinate must have a defined meaning: two channels, two features or two spatial directions. The dot product multiplies matching coordinates and adds the products. This is both a weighted sum and, for ordinary Euclidean coordinates, a geometric alignment measure.

Length changes the score

The Euclidean norm is the square root of the sum of squared coordinates. Dot product equals the product of both lengths and the cosine of their angle. Cosine similarity divides out length; it is undefined for a zero vector. Feature units and scaling matter: mixing metres and milliseconds without a scaling convention changes the geometry.

q·k = Σᵢ qᵢkᵢ = ‖q‖‖k‖cos θ

Worked example

[1,2]·[3,4] = 3+8 = 11. The norm of [3,4] is √(9+16)=5. Doubling [3,4] doubles its dot product with [1,2] but leaves cosine similarity unchanged.

A common trap

A large dot product does not, by itself, imply a small angle: one vector might simply be very long.

Predict, then experiment

If the angle is 90°, can increasing the second vector’s length make the dot product nonzero? Before touching the controls, say or write your prediction.

Try it yourself

Angle is not length

How do direction and scale affect similarity?

q=[1,0]; k has adjustable length and angle. Solid is q; dashed is k. Both coordinates are dimensionless. Cosine is undefined for a zero vector.

Can you make it happen?

Make the dot product negative while keeping the length at least 1.

Predict a setting before you try it. This optional challenge checks the current parameters, not lesson completion.

A hint

The sign comes from direction, not length. Which angles point against q?

One solution & why it works

For example, angle 120° and length 1 give q·k = −0.5. Any angle with negative cosine works if length ≥ 1.

Your experiment

Hold q=[1,0]. Change the angle of k through 0°, 90° and 180° and its length from 1 to 2. Compare the dot product and cosine readouts.

Change one parameter at a time. Compare what you observed with your prediction and record an explanation in your notes.

Check your understanding

Try from memory first. Hints and feedback are part of learning, not a penalty. These checks are for self-study, not a graded qualification.

1. When you double one nonzero vector, cosine similarity with a fixed vector…
Give me a hint

Think about the angle, not length.

2. Calculate [2,−1]·[3,4].

Accepted absolute tolerance: ±0.001 .

Give me a hint

Multiply matching coordinates and add.

Reference answers (after your attempt)
  1. stays the same — Correct: direction did not change.
  2. 2 — 2×3 + (−1)×4 = 2.

Apply it: Choose a sensible feature space

Use paper, your notes, or a local notebook/editor. Code examples are Python 3 starting points to run yourself; this page does not execute code or automatically assess the practical task.

  1. Propose two features for a sound clip.
  2. Explain their units and whether they need scaling.
  3. Compute a dot product for two example feature vectors.
Reference solution & review criteria

Duration in seconds and energy in digital amplitude² are possible features, but their units differ. Scale using training-set statistics or a justified physical convention before treating Euclidean alignment as similarity.

Your notebook

Notes and progress stay in this browser. They are not sent to the server; ordinary web-server request logs still operate. Export a backup from the course page.

Review list

Completion requires both correct checks and your practical-task acknowledgement.

Go deeper

Sources support further study; the worked examples and questions here are original. Browser experiments are small, disclosed models—not evidence of production-model quality or hardware performance.