Gratis å bruke, uten konto

Vektorkalkulator

Arbeid med 2D- eller 3D-vektorer: legg sammen, trekk fra, mål, normaliser, sammenlign vinkler, projiser eller finn kryssprodukt.

Vektor A
Vektor B

Eksempelet bruker enhetsvektorer langs x- og y-aksene.

Beregning av komponenter uten enheter; oppgi komponenter med kompatible enheter. Inndata er begrenset til ±1 000 000 000. Vinkler krever vektorer som ikke er null. I 2D er kryssproduktet en skalar med fortegn; i 3D er det en vektor.

Hvilke vektoroperasjoner kan jeg beregne?

Velg 2D eller 3D, skriv inn vektorkomponentene og velg en operasjon. Et 2D-kryssprodukt vises som den fortegnede z-komponenten; et 3D-kryssprodukt gir en vektor. Vinkler oppgis i grader.

Veiledning

Slik bruker du Vektorkalkulator

The Vector Calculator works with two vectors, A and B, in two or three dimensions. You type their components, pick one operation and get the answer. It can add, subtract, find a dot product or cross product, measure length, make a unit vector, give the angle between the vectors in degrees, or project A onto B. It handles plain numbers only, with no units and no symbols.

Slik gjør du

  1. Choose 2D or 3D. In 2D the z boxes are hidden; in 3D they appear.
  2. Pick an operation from the list. The starting choice is the dot product.
  3. Fill in every component of vector A and vector B. Each number must lie between −1,000,000,000 and 1,000,000,000.
  4. Press Calculate. Under the answer, the page also shows the length of A, the length of B and the dot product. Load example fills in a 3D cross product of two axis vectors.

Eksempler

A 2D dot product

Du skriver inn
Dimensjon
2D
Operasjon
Dot product
A
1; 2
B
3; 4
Du får
Resultat
11
Lengden av A
2.236068
Lengden av B
5
Skalarprodukt A · B
11

The dot product is 1 × 3 + 2 × 4 = 11. The length of A is the square root of 1² + 2², which is about 2.236068, and the length of B is the square root of 25, which is 5.

Kjørt med verktøyets egen kode.

A 3D cross product

Du skriver inn
Dimensjon
3D
Operasjon
Cross product
A
2; 3; 4
B
5; 6; 7
Du får
Resultat
(-3, 6, -3)
Lengden av A
5.385165
Lengden av B
10.488088
Skalarprodukt A · B
56

The cross product is (3×7 − 4×6, 4×5 − 2×7, 2×6 − 3×5), which is (−3, 6, −3). This vector is at right angles to both A and B.

Kjørt med verktøyets egen kode.

The angle between two 2D vectors

Du skriver inn
Dimensjon
2D
Operasjon
Angle between A and B
A
1; 0
B
1; 1
Du får
Resultat
45
Lengden av A
1
Lengden av B
1.414214
Skalarprodukt A · B
1

The cosine of the angle is the dot product, 1, divided by the product of the lengths, 1 × 1.414214. That gives 0.707107, and the angle is 45 degrees.

Kjørt med verktøyets egen kode.

Projecting A onto B

Du skriver inn
Dimensjon
2D
Operasjon
Project A onto B
A
3; 4
B
1; 2
Du får
Resultat
(2.2, 4.4)
Lengden av A
5
Lengden av B
2.236068
Skalarprodukt A · B
11

The projection is B scaled by (A · B) / |B|². Here that is 11 / 5 = 2.2, applied to (1, 2), so the result is (2.2, 4.4).

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Check homework on dot products, cross products and angles in a physics or linear algebra course.
  • Find a unit direction vector from a displacement before using it in a program or a game.
  • Test whether two vectors are perpendicular by looking for a dot product of 0.
  • Split a force or velocity into the part along a chosen direction using the projection.

Begrensninger

  • Only 2D and 3D vectors are supported, and always exactly two vectors. There are no 4D vectors and no list of several vectors.
  • Every component is required, must be a finite number, and must be at most 1,000,000,000 in size. A result outside the supported range shows an error.
  • Normalizing a zero vector, finding an angle when either vector is zero, and projecting onto a zero vector are all undefined, and the tool says so.
  • Results are shown to at most 6 decimal places. Because of rounding in the arithmetic, vectors that point the same way can show an angle of 0.000001 degrees, and exact opposites can show 179.999999, instead of 0 and 180.
  • The numbers carry no units. Use compatible units for both vectors yourself.

Tips

  • In 2D, the cross product is only the signed z-component, a single number. Switch to 3D with z set to 0 if you want the full vector.
  • A dot product of exactly 0 for two nonzero vectors means they are perpendicular. A tiny nonzero value from decimal inputs may be rounding, not a real difference.
  • Normalize first if you only care about direction, then use the unit vector in later steps.

Kilder

Vanlige spørsmål

Which operations can I choose?

Add A + B, subtract A − B, dot product, cross product, magnitude of A, magnitude of B, normalize A, normalize B, the angle between A and B, and project A onto B. Whatever you choose, the page also lists both lengths and the dot product.

What is the difference between the dot product and the cross product?

The dot product multiplies matching components and adds them, giving one number. The cross product gives a new 3D vector that is perpendicular to both inputs. In 2D the tool shows only a single signed number, the z-component.

In what unit is the angle shown?

In degrees, not radians. It is the angle between 0 and 180 degrees found from the dot product divided by the two lengths. It does not say which direction you would turn to get from A to B.

Why can't I normalize or find an angle for a zero vector?

A zero vector has no length to divide by and no direction. Normalizing needs to divide by the length, and the angle formula divides by both lengths, so the tool stops with an explanation instead of giving a number.

What does 'project A onto B' give me?

It gives the part of A that points along B, as a vector. Its size is how far A reaches in B's direction. The leftover part of A is at right angles to B and is not shown.

Why does the angle sometimes show 0.000001 rather than 0?

Computers store decimals with tiny rounding errors. For vectors that are exactly parallel, the cosine can come out a hair different from 1, and the angle then appears as a very small positive number. Treat it as zero for practical purposes.

Can I use fractions or expressions like 1/3 or sqrt(2)?

No. Each box takes a plain number. Type a decimal such as 0.333333 instead. This makes the result slightly different from the exact value.

Is the order of A and B important?

Yes for some operations. A − B differs from B − A, and the cross product changes sign when you swap the vectors. Adding and the dot product give the same result in either order.

Are my numbers sent anywhere?

No. The page says the operations run in your browser and are not sent to a remote service. The tool keeps no history, so copy results you need before you leave the page.

Hvilke vektoroperasjoner kan jeg beregne?

Velg 2D eller 3D, skriv inn vektorkomponentene og velg en operasjon. Et 2D-kryssprodukt vises som den fortegnede z-komponenten; et 3D-kryssprodukt gir en vektor. Vinkler oppgis i grader.

Lastes vektorverdiene mine opp?

Nei. Vektoroperasjoner kjøres i denne nettleseren og sendes ikke til en ekstern tjeneste.

Er et 2D-kryssprodukt en vektor?

I 2D gir verktøyet den fortegnede skalarverdien for z-komponenten. I 3D gir det hele kryssproduktvektoren.

Vises vinkler i radianer?

Nei. Vinkelen mellom to vektorer som ikke er null, vises i grader.