{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $n$ be a positive integer, and let $u$ and $v$ be nonzero [[vectors|0QN3D80AWP]] in $\\mathbb{R}^n$.\nLet $u \\cdot v = u_1 v_1 + \\dots + u_n v_n$ be their dot product, and let $\\|u\\|$ and $\\|v\\|$ be their [[lengths|0XKBKGTCPC]].\nThe angle between $u$ and $v$ is the unique real number $\\theta$ with $0 \\leq \\theta \\leq \\pi$ such that\n$$\\cos \\theta = \\frac{u \\cdot v}{\\|u\\| \\, \\|v\\|}.$$\nThe Cauchy–Schwarz inequality $|u \\cdot v| \\leq \\|u\\| \\, \\|v\\|$ makes sure that the quotient is in $[-1, 1]$. Thus $\\theta = \\arccos\\left(\\frac{u \\cdot v}{\\|u\\| \\, \\|v\\|}\\right)$ exists.\n\n## Remarks\n\nThe angle is $0$ if and only if $v = c u$ for a real number $c \u003e 0$. It is $\\pi$ if and only if $v = c u$ for a real number $c \u003c 0$.\nThe angle does not depend on the order of the vectors. It does not change when you multiply $u$ or $v$ by a positive number.\nMathlib uses the same formula for all vectors. With the convention $0 / 0 = 0$, the angle between the zero vector and any vector is then $\\pi / 2$.\n\n## Explanations\n\n### L1 human\n\nPut the two arrows at the same start point. The angle between them is the opening between the arrows, measured in radians from $0$ to $\\pi$. For example, $(1, 0)$ and $(0, 1)$ have dot product $0$, so the angle between them is $\\arccos 0 = \\pi / 2$, a right angle.\n",
  "commit": "6ac761d40018146541484a9e8b9eafd6ecc303dc",
  "front": {
    "defines": "0ZEHZY85E6",
    "kind": "definition",
    "msc": [
      "51N20"
    ],
    "name": "Angle between two vectors",
    "sources": [
      {
        "locator": "Inner product",
        "url": "https://en.wikipedia.org/wiki/Angle"
      },
      {
        "locator": "Geometric definition",
        "url": "https://en.wikipedia.org/wiki/Dot_product"
      }
    ],
    "tag": "0PRAS55318",
    "uses": [
      "0QN3D80AWP",
      "0XKBKGTCPC"
    ]
  },
  "kind": "definition",
  "link": "https://math2.tamnd.com/node/0PRAS55318/",
  "links": [
    {
      "field": "defines",
      "target": "0ZEHZY85E6"
    },
    {
      "field": "uses",
      "target": "0QN3D80AWP"
    },
    {
      "field": "uses",
      "target": "0XKBKGTCPC"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/0PRAS55318.md",
  "msc": [
    "51N20"
  ],
  "name": "Angle between two vectors",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/0PR/0PRAS55318.md",
  "status": null,
  "tag": "0PRAS55318",
  "uri": "m2://0PRAS55318",
  "url": "https://math2.tamnd.com/wiki/angle-between-two-vectors-definition/",
  "writing": {
    "tag": "0PRAS55318",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
