Jephian Lin
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 垂直幾何 Orthogonal geometry ![Creative Commons License](https://i.creativecommons.org/l/by/4.0/88x31.png) This work by Jephian Lin is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). $\newcommand{\trans}{^\top} \newcommand{\adj}{^{\rm adj}} \newcommand{\cof}{^{\rm cof}} \newcommand{\inp}[2]{\left\langle#1,#2\right\rangle} \newcommand{\dunion}{\mathbin{\dot\cup}} \newcommand{\bzero}{\mathbf{0}} \newcommand{\bone}{\mathbf{1}} \newcommand{\ba}{\mathbf{a}} \newcommand{\bb}{\mathbf{b}} \newcommand{\bc}{\mathbf{c}} \newcommand{\bd}{\mathbf{d}} \newcommand{\be}{\mathbf{e}} \newcommand{\bh}{\mathbf{h}} \newcommand{\bp}{\mathbf{p}} \newcommand{\bq}{\mathbf{q}} \newcommand{\br}{\mathbf{r}} \newcommand{\bx}{\mathbf{x}} \newcommand{\by}{\mathbf{y}} \newcommand{\bz}{\mathbf{z}} \newcommand{\bu}{\mathbf{u}} \newcommand{\bv}{\mathbf{v}} \newcommand{\bw}{\mathbf{w}} \newcommand{\tr}{\operatorname{tr}} \newcommand{\nul}{\operatorname{null}} \newcommand{\rank}{\operatorname{rank}} %\newcommand{\ker}{\operatorname{ker}} \newcommand{\range}{\operatorname{range}} \newcommand{\Col}{\operatorname{Col}} \newcommand{\Row}{\operatorname{Row}} \newcommand{\spec}{\operatorname{spec}} \newcommand{\vspan}{\operatorname{span}} \newcommand{\Vol}{\operatorname{Vol}} \newcommand{\sgn}{\operatorname{sgn}} \newcommand{\idmap}{\operatorname{id}} \newcommand{\am}{\operatorname{am}} \newcommand{\gm}{\operatorname{gm}} \newcommand{\mult}{\operatorname{mult}} \newcommand{\iner}{\operatorname{iner}}$ ```python from lingeo import random_int_list, random_good_matrix from linspace import QR ``` ## Main idea The notion of "angle" is not necessary possible for every vector space. However, many vector spaces over $\mathbb{R}$ or $\mathbb{C}$ do have (at least) one meaningful inner product, and the angle is therefore defined. Such a vector space is called an _inner product space_. Here, we only focus on concrete examples. Let $V$ be a vector space and $\inp{\cdot}{\cdot}$ an inner product on $V$. Recall that $\bu$ and $\bv$ are **orthogonal** if $\inp{\bu}{\bv} = 0$. Let $S = \{\bu_1, \ldots, \bu_k\}$ be a collection of vectors. Then $S$ is **orthogonal** if $\inp{\bu_i}{\bu_j} = 0$ for any pair of distinct $i,j$. Moreover, if $S$ is orthogonal and $\|\bu\|^2 = \inp{\bu_i}{\bu_i} = 1$ for any $i$, then $S$ is called **orthognormal**. If a basis $\beta$ is orthogonal, then one may rescale every vector to length one to make it orthonormal. Suppose $S = \{\bu_1, \ldots, \bu_k\}$ is orthogonal. Then $$ \begin{array}{cc} & (a_1\bu_1 + \cdots a_k\bu_k) \\ \cdot & (b_1\bu_1 + \cdots b_k\bu_k) \\ = & (a_1b_1\|\bu_1\|^2 + \cdots a_kb_k\|\bu_k\|^2) \\ \end{array} $$ holds for any two linear combination of $S$. In particular, when $S$ is orthonormal, the inner product is $$ (a_1\bu_1 + \cdots a_k\bu_k) \cdot (b_1\bu_1 + \cdots b_k\bu_k) = a_1b_1 + \cdots + a_kb_k, $$ and the length is $$ \|a_1\bu_1 + \cdots a_k\bu_k\| = a_1^2 + \cdots + a_k^2. $$ Let $\bb$ be a vector and $S = \{\bu_1, \ldots, \bu_k\}$ is orthogonal. Suppose $\bb_1, \ldots, \bb_k$ are the projection of $\bb$ onto each vectors $\bu_1, \ldots, \bu_k$, respectively, and $\bb_S$ is the projection of $\bb$ onto $\vspan(S)$. Then $\bb_S = \bb_1 + \cdots + \bb_k$. Let $\bb$ be a vector and $V$ a subspace. Suppose $\bb$ can be written as $\bb = \bw + \bh$ such that $\bw\in V$ and $\bh\in V^\perp$. Then $\bv = \bw$ minimize the length $\|\bb - \bv\|$ among all vector $\bv \in V$. ## Side stories - linear regression - inner product space ## Experiments ##### Exercise 1 執行以下程式碼。 令 $S = \{\bu_1,\ldots,\bu_3\}$ 為 $Q$ 中的各行向量。 己知 $\bb\in \vspan(S)$。 <!-- eng start --> Run the code below. Let $S = \{\bu_1,\ldots,\bu_3\}$ be the columns of $Q$. Suppose $\bb\in \vspan(S)$. <!-- eng end --> ```python ### code set_random_seed(0) print_ans = False m,n,r = 4,3,3 A = random_good_matrix(m,n,r,bound=1) Q, R = QR(A) v = vector(random_int_list(3,2)) b = Q * v print("Q =") show(Q) print("b =", b) if print_ans: print("S is orthogonal but not orthonormal.") print("b = " + " + ".join("%s u%s"%(v[i],i+1) for i in range(n))) print("Length of b =", b.norm()) ``` ##### Exercise 1(a) 判斷 $S$ 是否垂直、 是否單位長垂直。 <!-- eng start --> Is $S$ orthogonal? Is it orthonormal? <!-- eng end --> ##### Exercise 1(b) 找出一組向量 $S'$ 使得 $\vspan(S') = \vspan(S)$ 且 $S'$ 是單位長垂直。 <!-- eng start --> Find an orthonormal set $S'$ such that $\vspan(S') = \vspan(S)$. <!-- eng end --> ##### Exercise 1(c) 將 $\bb$ 寫成 $S$ 的線性組合。 <!-- eng start --> Write $\bb$ as a linear combination of $S$. <!-- eng end --> ##### Exercise 1(d) 利用 $\bb$ 的線性組合算出 $\bb$ 的長度。 <!-- eng start --> Use the linear combination of $\bb$ to calculate the length of $\bb$. <!-- eng end --> ## Exercises ##### Exercise 2 以下小題討論垂直和線性獨立的關係。 <!-- eng start --> The following problems study the relations between orthogonality and linear independence. <!-- eng end --> ##### Exercise 2(a) 證明如果 $S$ 是單位長垂直的﹐則 $S$ 線性獨立。 <!-- eng start --> Show that if $S$ is orthonormal, then $S$ is linearly independent. <!-- eng end --> ##### Exercise 2(b) 找一組向量集合 $S$ 使得它是垂直的但不線性獨立。 <!-- eng start --> Find an example of an orthogonal set $S$ such that $S$ is not linearly independent. <!-- eng end --> ##### Exercise 3 令 $$ A = \begin{bmatrix} 1 & 1 \\ 1 & 2 \\ 1 & 3 \\ 1 & 4 \\ \end{bmatrix} $$ 而 $\bb = (2.4, 3.1, 3.4, 4.1)$。 <!-- eng start --> Let $$ A = \begin{bmatrix} 1 & 1 \\ 1 & 2 \\ 1 & 3 \\ 1 & 4 \\ \end{bmatrix} $$ and $\bb = (2.4, 3.1, 3.4, 4.1)$. <!-- eng end --> ##### Exercise 3(a) 求 $\Col(A)$ 中和 $\bb$ 最接近的向量 $\bw$、 並將它寫成 $A$ 的行向量的線性組合。 <!-- eng start --> Find the vector in $\Col(A)$ that is the closest to $\bw$ and write it as a linear combination of columns of $A$. <!-- eng end --> ##### Exercise 3(b) 令 $(x_1,x_2,x_3,x_4) = (1,2,3,4)$ 為 $A$ 的第二個行向量 且 $(y_1,y_2,y_3,y_4) = (2.4, 3.1, 3.4, 4.1) = \bb$。 求解 $c_0$ 和 $c_1$ 使得 $\sum_{i=1}^4 (c_0 + c_1x_i - y_i)^2$ 最小。 <!-- eng start --> Let $(x_1,x_2,x_3,x_4) = (1,2,3,4)$ be the second column of $A$ and $(y_1,y_2,y_3,y_4) = (2.4, 3.1, 3.4, 4.1) = \bb$. Find $c_0$ and $c_1$ such that $\sum_{i=1}^4 (c_0 + c_1x_i - y_i)^2$ is minimized. <!-- eng end --> ##### Exercise 4 令 $$ A = \begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 \\ 0 & 1 & 2 & 3 \\ \end{bmatrix} $$ 且 $\bb = (3,3,2)$。 求解集合 $U = \{ \bx\in\mathbb{R}^4 : A\bx = \bb \}$ 中長度最短的向量。 <!-- eng start --> Let $$ A = \begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & 1 & 1 & 1 \\ 0 & 1 & 2 & 3 \\ \end{bmatrix} $$ and $\bb = (3,3,2)$. Find the vector in the solution set $U = \{ \bx\in\mathbb{R}^4 : A\bx = \bb \}$ with the minimum length. <!-- eng end --> ##### Exercise 5 一個_內積_ $\inp{\cdot}{\cdot}$ 要符合以下的條件: 1. $\inp{\bx_1 + \bx_2}{\by} = \inp{\bx_1}{\by} + \inp{\bx_2}{\by}$. 2. $\inp{k\bx}{\by} = k\inp{\bx}{\by}$. 3. $\inp{\bx}{\by} = \inp{\by}{\bx}$. 4. $\inp{\bx}{\bx} \geq 0$, and the equality holds if and only if $\bx = \bzero$. 驗證以下定義的各種雙變數函數都可視為內積。 <!-- eng start --> An _inner product_ $\inp{\cdot}{\cdot}$ is a bivariate function with the following properties: 1. $\inp{\bx_1 + \bx_2}{\by} = \inp{\bx_1}{\by} + \inp{\bx_2}{\by}$. 2. $\inp{k\bx}{\by} = k\inp{\bx}{\by}$. 3. $\inp{\bx}{\by} = \inp{\by}{\bx}$. 4. $\inp{\bx}{\bx} \geq 0$, and the equality holds if and only if $\bx = \bzero$. Verify each of the following bivariate functions can be viewed as an inner product. <!-- eng end --> ##### Exercise 5(a) 考慮 $V = \mathcal{M}_{2,3}$。 定義兩矩陣 $A$ 和 $B$ 的內積為 $$ \inp{A}{B} = \tr(B\trans A). $$ <!-- eng start --> Consider $V = \mathcal{M}_{2,3}$. Define the inner product of two matrices $A$ and $B$ as $$ \inp{A}{B} = \tr(B\trans A). $$ <!-- eng end --> ##### Exercise 5(b) 考慮 $V = \mathcal{P}_3$。 定義兩多項式 $$ \begin{aligned} p_1 &= a_0 + a_1x + a_2x^2 + a_3x^3 \\ p_2 &= b_0 + b_1x + b_2x^2 + b_3x^3 \\ \end{aligned} $$ 的內積為 $$ \inp{p_1}{p_2} = a_0b_0 + a_1b_1 + a_2b_2 + a_3b_3. $$ <!-- eng start --> Consider $V = \mathcal{P}_{3}$. Define the inner product of two polynomials $$ \begin{aligned} p_1 &= a_0 + a_1x + a_2x^2 + a_3x^3 \\ p_2 &= b_0 + b_1x + b_2x^2 + b_3x^3 \\ \end{aligned} $$ as $$ \inp{p_1}{p_2} = a_0b_0 + a_1b_1 + a_2b_2 + a_3b_3. $$ <!-- eng end --> ##### Exercise 5(c) 考慮 $V = \mathcal{P}_3$。 定義兩多項式 $p_1$ 和 $p_2$ 的內積為 $$ \inp{p_1}{p_2} = p_1(1)p_2(1) + p_1(2)p_2(2) + p_1(3)p_2(3) + p_1(4)p_2(4). $$ <!-- eng start --> Consider $V = \mathcal{P}_{3}$. Define the inner product of two polynomials $p_1$ and $p_2$ as $$ \inp{p_1}{p_2} = p_1(1)p_2(1) + p_1(2)p_2(2) + p_1(3)p_2(3) + p_1(4)p_2(4). $$ <!-- eng end --> ##### Exercise 5(d) 考慮 $V$ 為 $[0,1]$ 區間上的所有連續函數。 定義兩函數 $f$ 和 $g$ 的內積為 $$ \inp{f}{g} = \int_0^1 fg\, dx. $$ <!-- eng start --> Consider $V$ as the vector space of all continuous functions on the interval $[0,1]$. Define the inner product of two functions $f$ and $g$ as $$ \inp{f}{g} = \int_0^1 fg\, dx. $$ <!-- eng end -->

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully