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
    # 向量空間 Vector space ![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 ``` ## Main idea The vectors in $\mathbb{R}^n$ enjoy some nice properties, such as $\bu + \bv = \bv + \bu$. Although one can always expand a vector $\bx$ in $\mathbb{R}^n$ as $(x_1,\ldots, x_n)$, this seemingly natural setting is not always required. For example, linear combinations $c_1\bu_1 + \cdots + c_d\bu_d$ are defined without really examing the entries. Similarly, we may say `apple` and `banana` are vectors. We can make a linear combination like `1 apple + 2 banana` and say `{ apple, banana }` is a linearly independent set since intuitively there is no way to replace `apples` with `bananas` such as `1 apple + 2 banana = 0` . ##### Definition (Vector space) A **vector space** over $\mathbb{R}$ consists of three parts: 1. a set $V$ (considered as the set of vectors), 2. an addition $+$ for two vectors, and 3. a scalar multiplication $\cdot$ for a scalar and a vector. The addition has to have the following basic properties: 1. For any $\bu, \bv\in W$, $\bu + \bv\in W$. (closed under vector addition) 2. For any $\bu, \bv\in W$, $\bu + \bv = \bv + \bu$. (commutative) 3. For any $\bu, \bv, \bw\in W$, $(\bu + \bv) + \bw = \bu + (\bv + \bw)$. (associative) 4. There is a **zero vector** $\bzero\in V$ such that $\bv + \bzero = \bv$ for any $\bv\in V$. (additive identity) 5. Every vector $\bv$ has an additive inverse $\bw$ such that $\bv + \bw = \bzero$. (additive inverse) The scalar multiplication has to cooperate with the addition in a good mannar: 6. For any $k\in\mathbb{R}$ and $\bv\in V$, $k\cdot \bv\in V$. (closed under scalar multiplication) 7. For any $k,\ell\in\mathbb{R}$ and $\bv\in V$, $(k + \ell)\cdot \bv = k\cdot\bv + \ell\cdot\bv$. (distributive over scalar addition) 8. For any $k\in\mathbb{R}$ and $\bu, \bv\in V$, $k\cdot(\bu + \bv) = k\cdot \bu + k\cdot\bv$. (distributive over vector addition) 9. For any $k,\ell\in\mathbb{R}$ and $\bv\in V$, $(rs)\cdot \bv = r\cdot(s\cdot\bv)$. (associative over field multiplication and scalar multiplication) 10. For $1\in\mathbb{R}$ and $\bv\in V$, $1\cdot \bv = \bv$. ($1$ is the identity operation) Obviously, one may check $\mathbb{R}^n$ along with the classical vector addition $+$ and the scalar multiplication $\cdot$ is a vector space. In addition, the following can be viewed as vector spaces with the standard vector addition and scalar multiplication: 1. All polynomial of degree at most $d$. 2. All $m\times n$ matrices over $\mathbb{R}^n$. 3. All functions on the interval $[0,1]$. 4. All continuous functions on the interval $[0,1]$. There are still many instances of vector spaces. And the nice thing about them is all the things we have learnt so far also apply to them, including span, linearly independence, dimension, ans so on. We usually consider $\mathbb{R}$ as the scalar, but any other number system with a _field_ structure also works. A field is, roughly speaking, a set of elements equipped with customized $+$, $-$, $\times$, and $\div$. Common examples are $\mathbb{R}$, $\mathbb{C}$, and $\mathbb{Q}$. In contrast, $\mathbb{Z}$ is not a field since it does not allow division. ## Side stories - field - polynomial space - matrix space ## Experiments ##### Exercise 1 執行以下程式碼。 令 $S = \{ p_1, p_2, p_3 \}$。 <!-- eng start --> Run the code below. Let $S = \{ p_1, p_2, p_3 \}$. <!-- eng end --> ```python ### code set_random_seed(0) print_ans = False m,n,r = 3,3,choice([2,3]) A = random_good_matrix(m,n,r) v = vector(random_int_list(m)) b = v * A xp = vector([x**p for p in range(n)]) ps = A * xp for i in range(m): pretty_print("p%s ="%(i+1), ps[i]) pretty_print("b =", b * xp) if print_ans: print("b = " + " + ".join("%s p%s"%(v[i], i+1) for i in range(n)) ) print("Linearly independent?", r == 3) print("span = all polynomial of degree at most 2?", r == 3) ``` ##### Exercise 1(a) 將 $b$ 寫成 $S$ 的線性組合。 <!-- eng start --> Write $b$ as a linear combination of $S$. <!-- eng end --> **[由張永賦提供]** **Solution:** By solving the equation $b=c_1p_1+c_2p_2+c_3p_3$, we get $$ b=(-1)p_1+1p_2+1p_3. $$ ##### Exercise 1(b) 判斷 $S$ 是否線性獨立? <!-- eng start --> Is $S$ linearly independent? <!-- eng end --> **[由張永賦提供]** **Solution:** No! We can not find any coefficient $c_1,c_2\in\mathbb{R}$ except $c_1=c_2=0$ for the equation $c_1p_1+c_2p_2=0$. Thus, $\{p_1,p_2\}$ is linear independent. If S is linear independent, then we can not find any $c_1,c_2\in\mathbb{R}$ such that $p_3=c_1p_1+c_2p_2$. Solve the equation $p_3=c_1p_1+c_2p_2$: $$ 45x^2-23x-9=c_1(-5x^2+3x+1)+c_2(15x^2-8x-3). $$ After solving the equation, we get $c_1=3,c_2=4$. Thus, $S$ is not linearly independent. ##### Exercise 1(c) 判斷 $\vspan(S)$ 是否等於所有二次以下的多項式? <!-- eng start --> Is $\vspan(S)$ the same as the set of all polynomials of degree at most $2$? <!-- eng end --> ## Exercises ##### Exercise 2 令 $$ \begin{aligned} p_1 &= (x + 1)(x + 2), \\ p_2 &= (x + 1)(x + 3) \end{aligned} $$ 且 $S = \{p_1, p_2\}$。 <!-- eng start --> Let $$ \begin{aligned} p_1 &= (x + 1)(x + 2), \\ p_2 &= (x + 1)(x + 3) \end{aligned} $$ and $S = \{p_1, p_2\}$. <!-- eng end --> ##### Exercise 2(a) 寫出一個 $S$ 的線性組合。 <!-- eng start --> Write an example of a linear combination of $S$. <!-- eng end --> **[由張永賦提供]** **Solution:** $$ 1p_1+1p_2=2x^2+7x+5. $$ ##### Exercise 2(b) 判斷 $S$ 是否線性獨立。 <!-- eng start --> Is $S$ linearly independent? <!-- eng end --> **[由張永賦提供]** **Solution:** Yes! Solve $c_1p_1+c_2p_2=0$. There is only one solution $c_1=c_2=0$. Thus, $S$ is linearly independent. ##### Exercise 2(c) 判斷 $\vspan(S)$ 是否等於所有二次以下的多項式。 <!-- eng start --> Is $\vspan(S)$ the same as the set of all polynomials of degree at most $2$? <!-- eng end --> **[由張永賦提供]** **Solution:** No. Since $x^2+8x+5 = c_1p_1+c_2p_2$ has no solution and it is not in the $\vspan(S)$. Thus, $\vspan(S)$ is not same as the set of all polynomials of degree at most $2$. ##### Exercise 3 令 $$ \begin{aligned} A_1 &= \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}, \\ A_2 &= \begin{bmatrix} 1 & 2 \\ 2 & 1 \end{bmatrix}, \\ A_3 &= \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} \end{aligned} $$ 且 $S = \{A_1, A_2, A_3\}$。 <!-- eng start --> Let $$ \begin{aligned} A_1 &= \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}, \\ A_2 &= \begin{bmatrix} 1 & 2 \\ 2 & 1 \end{bmatrix}, \\ A_3 &= \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} \end{aligned} $$ and 且 $S = \{A_1, A_2, A_3\}$. <!-- eng end --> ##### Exercise 3(a) 寫出一個 $S$ 的線性組合。 <!-- eng start --> Write an example of a linear combination of $S$. <!-- eng end --> **[由張永賦提供]** **Solution:** $$ 1A_1+1A_2+1A_3= \begin{bmatrix} 4 & 4 \\ 4 & 4 \end{bmatrix}. $$ ##### Exercise 3(b) 判斷 $S$ 是否線性獨立。 <!-- eng start --> Is $S$ linearly independent? <!-- eng end --> **[由張永賦提供]** **Solution:** No! Solve the equation $c_1A_1+c_2A_2+c_3A_3=0$, $c_1, c_2, c_3\in\mathbb{R}$. Then we get the equation below, $$ \begin{cases} c_1+c_2+2c_3=0 \\ c_1+2c_2+c_3=0 \\ c_1+2c_2+c_3=0 \\ c_1+c_2+2c_3=0 \end{cases}. $$ After reduction, we get $$ c_2=c_3. $$ Therefore, there is a solution other than $c_1=c_2=c_3=0$, e.g., $c_1=-3, c_2=1, c_3=1.$ In other word, $S$ is not linearly independent! ##### Exercise 3(c) 判斷 $\vspan(S)$ 是否等於所有 $2\times 2$ 的實係數矩陣。 <!-- eng start --> Is $\vspan(S)$ the same as the set of all $2\times 2$ real matrices? <!-- eng end --> **[由張永賦提供]** **Solution:** No. Since $\begin{bmatrix}4 & 4 \\4 & 3 \end{bmatrix}=c_1A_1+c_2A_2+c_3A_3$ has no solution and it is not in the $\vspan(S)$. Thus, $\vspan(S)$ is not same as the set of all $2\times 2$ real matrices. ##### Exercise 4 以下考慮一種奇怪的加法 $\oplus$ 和乘法 $\otimes$。 考慮 $\mathbb{R}_+$ 為所有正實數的集合、$+$ 和 $\times$ 分別是實數的正常加法和乘法。 若 $a,b\in\mathbb{R}_+$ 定義 $a \oplus b = a \times b$﹐ 若 $k\in\mathbb{R}$ 而 $a\in\mathbb{R}_+$ 定義 $k\otimes a = a^k$。 驗證 $(\mathbb{R}_+, \oplus, \otimes)$ 配合在一起是一個向量空間。 <!-- eng start --> Consider a new addition $\oplus$ and a new multiplication $\otimes$. Let $\mathbb{R}_+$ be the set of all positive real numbers. Here $+$ and $\times$ are the ordinary addition and multiplication between two real numbers. For any $a, b\in\mathbb{R}_+$ and $k\in\mathbb{R}$, define $a \oplus b = a \times b$ and $k\otimes a = a^k$. Show that $(\mathbb{R}_+, \oplus, \otimes)$ is a vector space. <!-- eng end --> ##### Exercise 5 若 $V$ 為一向量空間。 證明以下性質。 <!-- eng start --> Let $V$ be a vector space. Prove the following properties. <!-- eng end --> ##### Exercise 5(a) 對於任何 $\bv\in V$,都有 $0\cdot \bv = \bzero$。 (這個式子的口頭敘述是: 實數的 $0$ 乘上任何一個向量 都是零向量。) <!-- eng start --> Show that $0\cdot \bv = \bzero$ for any $\bv\in V$. (Verbally, this says the scalar multiplication of $0$ and any vector is the zero vector.) <!-- eng end --> ##### Exercise 5(a) 對於任何 $\bv\in V$,$-1\cdot \bv + \bv = \bzero$。 (這個式子的口頭敘述是: 實數的 $-1$ 乘上任何一個向量 都是該向量的加法反元素。) <!-- eng start --> Show that $-1\cdot \bv + \bv = \bzero$ for any $\bv\in V$. (Verbally, this says the scalar multiplication of $-1$ and any vector is its additive inverse.) <!-- eng end --> ##### Exercise 6 一個 **體** 的指的是一個集合 $F$ 搭配一個加法一個乘法使得: 1. 加法和乘法都有交換律和結合律。 2. 乘法配合加法有分配律。 3. 加法有單位元素 $0$ 使得對任意 $a\in F$ 都有 $a + 0 = a$。 4. 乘法有單位元素 $1$ 使得對任意 $a\in F$ 都有 $a \cdot 1 = a$。 5. 每個元素 $a\in F$ 都有加法反元素 $b\in F$ 使得 $a + b = 0$。 6. 每個非加法單位元素 $0$ 的元素 $a\in F$ 都有乘法反元素 $b\in F$ 使得 $a \cdot b = 1$。 (想像實數集 $\mathbb{R}$、或是有理數集 $\mathbb{Q}$;但整數集 $\mathbb{Z}$ 則不是一個體。) 驗證 $\mathbb{Z}_2 = \{0,1\}$ 搭配 加法 $a + b = (a + b) \pmod{2}$ 和 乘法 $a \cdot b = a \cdot b$ 是一個體。 (所以向量空間中的純量也可以代換成 $\mathbb{Z}_2$。) <!-- eng start --> A **field** is a set $F$ along with two operations named the addition and the multiplication with the following properties: 1. The addition and the multiplication are both commutative and associative. 2. The multiplication is distributive with resepct to the addition. 3. There is an additive identity $0$ in $F$ such that $a + 0 = a$ for any $a\in F$. 4. There is an multiplicative identity $1$ in $F$ such that $a \cdot 1 = a$ for any $a\in F$. 5. Every element $a\in F$ has an additive inverse $b$ such that $a + b = 0$. 6. Every element $a\in F$ that is different from the additive identity $0$ has an multiplicative inverse $b$ such that $a \cdot b = 1$. For example, the set of real numbers $\mathbb{R}$ and the set of rational numbers $\mathbb{Q}$ are fields. In contrast, the set of integers $\mathbb{Z}$ is not a field. Verify that $\mathbb{Z}_2 = \{0,1\}$ along with the addition $a + b = (a + b) \pmod{2}$ and the multiplication $a \cdot b = a \cdot b$ is a field. (Therefore, $\mathbb{Z}_2$ can also be used as the scalars of a vector space.) <!-- 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