愚千慮
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • 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 No publishing access yet

        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.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        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
      • Make a copy
      • 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 Make a copy 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    --- title: "內積與外積" path: "內積與外積" --- {%hackmd @RintarouTW/About %} # 內積與外積 ## 內積 (Inner Product) <iframe src="https://rintaroutw.github.io/fsg/test/dot-product-geo0.svg" width="768" height="600"></iframe> $$ u \cdot v = v\cdot u = |u||v|\cos{\theta} $$ 在代數中,等量非常容易被視為等價,但在幾何中等量不等價於「全等」,在一般代數中內積交換律成立,不代表幾何意義全等,他們只是等量而已。 ### 內積值的幾何意義 回到幾何原點,此處仍不以線代概念之(行向量)線性組合視之。 若 ax + by = e,這個 e 可視為 $\vec{v} = \pmatrix{a\\b}$ 與 $\vec{u} = \pmatrix{x\\y}$ 的內積,內積值為 e。 * 投影與被投影向量的面積,$\cos\theta$ 控制 $\pm$,則 e 為一有向積。 e = $(|\vec{u}|\cos\theta)\cdot |\vec{v}|$ 或 $(|\vec{v}|\cos\theta)\cdot |\vec{u}|$ |面積|的大小是相對於原座標系的單位面積 ($\hat{i}\hat{j}$) * 將 $(|\vec{u}|\cos\theta)$ 或 $(|\vec{v}|\cos\theta)$ 視為相對於單位圓長度 1 之比例值,將 |u| 或 |v| 縮放,結果即自原點起的一長度(可為負值),此長度對應到被投影向量上的一個點,即為純量。 兩向量同向 ($\theta < 90^\circ$) 則內積值為正,反向 ($\theta > 90^\circ$) 則內積值為負。 a, b, x, y, e 之值皆相對於 $\hat{i},\ \hat{j}$。 ### 線代中內積的幾何意義 $$ \begin{bmatrix}a & b\end{bmatrix}\begin{bmatrix}x \\ y\end{bmatrix} = \begin{bmatrix}x & y\end{bmatrix}\begin{bmatrix}a \\ b\end{bmatrix} = e $$ 這個式子可說是線代中最根本的核心,每一行列計算,皆可視為列向量與行向量內積,且內積具有交換律,亦可行列互換,運算後其值相同 = e。 <iframe src="https://rintaroutw.github.io/fsg/test/dot-product-geo1.svg" width="768" height="600"></iframe> $$ \vec{u} = \pmatrix{x\\y}, \vec{v} = \pmatrix{a\\b}\\ \hat{u} = \pmatrix{u_x\\u_y} = \pmatrix{\frac{x}{|u|}\\ \frac{y}{|u|}}\\ \eqalign{ \vec{v}\cdot\vec{u} &= \vec{v}\cdot\hat{u}\cdot|u|\\ &= (au_x+bu_y)|u|\\ &= (\frac{ax+by}{|u|})|u|\\ &= ax+by } $$ 或是由平面矩陣變換壓縮至一維 x 軸的思考方式: $$ \begin{bmatrix}a & b \\ 0 & 0\end{bmatrix}\begin{bmatrix}x \\ y\end{bmatrix} = \begin{bmatrix}x & y \\ 0 & 0\end{bmatrix}\begin{bmatrix}a \\ b\end{bmatrix} = \begin{bmatrix}e \\ 0\end{bmatrix} $$ ### 內積交換律 兩直角三角形,除直角外,只要有一餘角相等即相似。 任意兩直線交於 A, 而 B, C 為兩各直線上任意兩點, 分別作垂線交於 D, E; <iframe src="https://rintaroutw.github.io/fsg/test/dot-product-communative.svg" width="768" height="600"></iframe> $$ \cases{ \angle ABE = \angle ACD\\ \angle BAE = \angle CAD\\ }\implies \triangle ABE \sim \triangle ACD\\ \therefore \overline{AB}:\overline{AE} = \overline{AC}:\overline{AD}\\ \overline{AB}\times\overline{AD} = \overline{AC}\times\overline{AE}\\ where, \cases{ \overline{AD} = \overline{AC}\cos{\angle\gamma}\\ \overline{AE} = \overline{AB}\cos{\angle\gamma} }\\ \implies\overline{AB}\times\overline{AC}\cos\angle\gamma = \overline{AC}\times\overline{AB}\cos\angle\gamma $$ 由此亦可證明,任意兩向量 $\vec{u},\vec{v}$,相互投影後內積值相等。 ### 內積與座標 <iframe src="https://rintaroutw.github.io/fsg/test/dot-product-coordinate.svg" width="768" height="600"></iframe> 以上為利用餘弦定理的代數證明,相信也是大多數人在學校時所學的方法,但此方法完全缺少了對投影變化的過程,無法看出純粹幾何上內積與投影的變化對應關係(包含正負有向積)。 <iframe src="https://rintaroutw.github.io/fsg/test/dot-product-coordinate-2.svg" width="768" height="600"></iframe> ### 內積只是純量? 老實說,我個人覺得內積不只是純量 (兩個長度相乘其實就是面積),幾何上是可以做圖出來,並對應到餘弦定理裡因為角度變化而增減的 (第三邊面積變化/2)。 <iframe src="https://rintaroutw.github.io/fsg/test/dot-product.svg" width="768" height="600"></iframe> ## 楔積與外積 (Wedge Product/Cross Product) 若說內積是由餘弦而來,Wedge Product 則是由兩向量所張的向量空間有向積,真若如此解釋,實在太過跳躍,能真聽懂才奇怪,我也不信數學的發展會如此跳躍。 ### 究竟是怎麼來的? 以下皆為個人推論當初發展楔積的人是如何思考的。 #### 最初 個人相信外積最初是為求三角形面積而來的概念,即 $$ \triangle = \frac{|a||b|\sin{\theta}}{2} $$ 其中 $|a||b|\sin{\theta}$ 就是兩倍的三角形面積 = 平行四邊形面積。 從這個式子就不難聯想到與內積 $|a||b|\cos{\theta}$ 相對,而且很美。 而人們更早之前就知道在平面上平行四邊形面積等於兩邊長座標 $$ |a_xb_y-b_xa_y| $$ 如下圖: <iframe src="https://rintaroutw.github.io/fsg/test/determinant.svg" width="768" height="600"></iframe> 證明: $$ a, b\ 所張平行四邊形面積為\\ (a_x+b_x)(a_y+b_y)-2\times\frac{a_xa_y}{2}-2\times\frac{b_xb_y}{2}-2\times{b_xa_y}\\ =a_xb_y-b_xa_y\\ 但若是 a, b 位置互換,面積則為\\ -a_xb_y+b_xa_y\\ (此為外積運算不具交換律的根本原因) $$ 也就是說當 $\theta <180^\circ$ 時, $$ |a||b|\sin{\theta}=|a_xb_y-b_xa_y| $$ 又再一次與內積的座標化 $$ |a||b|\cos{\theta}=a_xb_x+a_yb_y $$ 相對應。 > 與內積座標化是兩項相加而具有交換律不同,外積座標化卻不具有交換律,若交換就會變成負的,也就是說外積是受順序影響的,所以在此寫成絕對值且限定條件為 $\theta <180^\circ$,到目前為止皆非楔積的定義,主要在說明思路形成的過程。 之前的證明仍以量相同即相同的思路以代數來 (間接) 證明,對我而言有種倒果為因的感受,因為看不出究竟平行四邊形面積究竟是如何與兩向量投影有著直接的變化關係。 <iframe src="https://rintaroutw.github.io/fsg/test/determinant-2.svg" width="768" height="600"></iframe> ### 外積與座標 再來則是向三維向量 (座標) 的延伸問題,因為內積本身是純量,光靠餘弦定理就很完美又簡單的結合了三維的座標與向量;而外積就稍複雜了些,得依靠內積的運算,推導過程如下: $$ 令\ \vec{A}=\pmatrix{a_{1}\\a_{2}\\a_{3}},\vec{B}=\pmatrix{b_{1}\\b_{2}\\b_{3}},\\ 設\ \vec{N}=\pmatrix{x\\y\\z}\ 與\ \vec{A},\ \vec{B}\ 皆垂直,則\ \vec{N}\ 分別與\ \vec{A},\ \vec{B}\ 內積為\ 0\\ \begin{cases} a_{1}x+a_{2}y+a_{3}z &=0\ldots (1)\\ b_{1}x+b_{2}y+b_{3}z &=0\ldots (2) \end{cases}\\ \begin{aligned}\\ b_{2}(a_{1}x+a_{2}y+a_{3}z) &= 0\ldots (3)\\ a_{2}(b_{1}x+b_{2}y+b_{3}z) &= 0\ldots (4)\\[2ex] (3)-(4)\ :\ (a_{1}b_{2}-b_{1}a_{2})x &= (a_{2}b_{3}-b_{2}a_{3})z\\[2ex] b_{1}(a_{1}x+a_{2}y+a_{3}z) &= 0\ldots (5)\\ a_{1}(b_{1}x+b_{2}y+b_{3}z) &= 0\ldots (6)\\[2ex] (6)-(5)\ :\ (a_{1}b_{2}-b_{1}a_{2})y &= (a_{3}b_{1}-b_{3}a_{1})z\\ \end{aligned}\\ \therefore\ \vec{N} = \pmatrix{\frac{a_{2}b_{3}-b_{2}a_{3}}{a_{1}b_{2}-b_{1}a_{2}}z\\\frac{a_{3}b_{1}-b_{3}a_{1}}{a_{1}b_{2}-b_{1}a_{2}}z\\z}\\ 令\ z\ = (a_{1}b_{2}-b_{1}a_{2}) \implies \vec{N} = \pmatrix{a_{2}b_{3}-b_{2}a_{3}\\a_{3}b_{1}-b_{3}a_{1}\\ a_{1}b_{2}-b_{1}a_{2}}\\[3ex] \vec{N}\ 則為\ \vec{A}×\vec{B}\ 外積之定義\\ (z\ 的值是人為刻意選定的) $$ ### 結論 其實真正有趣的是「為何如此定義?」 1. 與內積型式對稱且兼俱美感 2. 好算且與克拉碼行列式中 Det (秩) 算法一致 > 說文解字:秩,積也。 3. 外積為一向量 $\vec{N}$,長度為 $|\vec{A}||\vec{B}|sin(θ)$ ,與內積 $|\vec{A}||\vec{B}|cos(θ)$ 為純量相對。$\vec{N}$ 也可以寫成 $$ |\vec{A}||\vec{B}|sin(θ)\cdot\hat{n}\\ \hat{n}\ 為\ \vec{N}\ 的單位向量 $$ 4. $|\vec{N}|$ 長度具有幾何意義即$\vec{A}, \vec{B}$ 所張之平行四邊形面積。 ###### tags: `math` `inner product` `wedge product` `cross product`

    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
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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