{ "cells": [ { "cell_type": "raw", "metadata": {}, "source": [ "---\n", "title: Biostat 216 Homework 4\n", "subtitle: 'Due Nov 10 @ 11:59pm'\n", "format:\n", " html:\n", " theme: cosmo\n", " embed-resources: true\n", " number-sections: true\n", " toc: true\n", " toc-depth: 4\n", " toc-location: left\n", " code-fold: false\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Submit a PDF (scanned/photographed from handwritten solutions, or converted from RMarkdown or Jupyter Notebook or Quarto) to Gradescope in BruinLearn. \n", "\n", "## Q1\n", "\n", "For any $\\mathbf{X} \\in \\mathbb{R}^{n \\times p}$ and $\\mathbf{y} \\in \\mathbb{R}^n$, show that the normal equation \n", "$$\n", "\\mathbf{X}' \\mathbf{X} \\boldsymbol{\\beta} = \\mathbf{X}' \\mathbf{y}\n", "$$\n", "always has at least one solution.\n", "\n", "## Q2\n", "\n", "Let $\\mathbf{A} \\in \\mathbb{R}^{m \\times n}$.\n", "\n", "1. Show that for any generalized inverse $\\mathbf{A}^-$, we have $\\text{rank}(\\mathbf{A}^-) \\ge \\text{rank}(\\mathbf{A})$.\n", "\n", "2. Show that the Moore-Penrose inverse $\\mathbf{A}^+$ has the same rank as $\\mathbf{A}$.\n", "\n", "## Q3 Householder reflections\n", "\n", "Let $\\mathbf{v} \\in \\mathbb{R}^n$. Define the **Householder reflection matrix**\n", "$$\n", "\\mathbf{H} = \\mathbf{I} - 2 \\frac{\\mathbf{v} \\mathbf{v}'}{\\|\\mathbf{v}\\|^2} = \\mathbf{I} - 2 \\mathbf{u} \\mathbf{u}',\n", "$$\n", "where $\\mathbf{u}$ is the unit vector $\\mathbf{v} / \\|\\mathbf{v}\\|$.\n", "\n", "1. Show that $\\mathbf{H}$ is symmetric and orthogonal.\n", "\n", "2. Let $\\mathbf{a}, \\mathbf{b} \\in \\mathbb{R}^n$ such that $\\|\\mathbf{a}\\| = \\|\\mathbf{b}\\|$. Find a Householder matrix such that $\\mathbf{H} \\mathbf{a} = \\mathbf{b}$.\n", "\n", "3. Let $\\mathbf{a} \\in \\mathbb{R}^n$ be a non-zero vector. Find a Householder matrix such that\n", "$$\n", "\\mathbf{H} \\mathbf{a} = \\begin{pmatrix} \\|\\mathbf{a}\\| \\\\ \\mathbf{0}_{n-1} \\end{pmatrix}.\n", "$$\n", "\n", "4. Let $\\mathbf{a} \\in \\mathbb{R}^n$. Find a Householder matrix such that\n", "$$\n", "\\mathbf{H} \\mathbf{a} = \\begin{pmatrix} a_1 \\\\ \\|\\mathbf{a}_{2:n}\\| \\\\ \\mathbf{0}_{n-2} \\end{pmatrix}.\n", "$$\n", "\n", "5. Let $\\mathbf{A} \\in \\mathbb{R}^{n \\times p}$. Describe how to find a sequence of Householder matrices $\\mathbf{H}_1, \\ldots, \\mathbf{H}_{p}$ such that\n", "$$\n", "\\mathbf{H}_{p} \\mathbf{H}_{p-1} \\cdots \\mathbf{H}_1 \\mathbf{A} = \\mathbf{R},\n", "$$\n", "where $\\mathbf{R} \\in \\mathbb{R}^{n \\times p}$ is an upper triangular matrix. \n", "\n", " Describe how this generates a full QR decomposition of matrix $\\mathbf{A} = \\mathbf{Q} \\mathbf{R}$, where $\\mathbf{Q} \\in \\mathbb{R}^{n \\times n}$ is an orthogonal matrix and $\\mathbf{R}$ is upper triangular.\n", "\n", "## Q4 Missile tracking\n", "\n", "A missile is fired from enemy territory, and its position in flight is observed by radar tracking devices at the following positions.\n", "\n", "| $x$=Position down range (1000 miles) | 0 | 0.25 | 0.5 | 0.75 | 1 |\n", "|:------------------------------------:|:-:|:-----:|:-----:|:-----:|:-----:|\n", "| $y$=Height (1000 miles) | 0 | 0.008 | 0.015 | 0.019 | 0.020 |\n", "\n", "Suppose that intelligence sources indicate that enemy missiles are programmed to follow a parabolic flight path: $y = f(x) = \\alpha_0 + \\alpha_1 x + \\alpha_2 x^2$. Where is the missile expected to land? Hint: You can find the solution using computer program. For example, in Julia, least squares solution is obtained by command `A \\ b`.\n", "\n", "![](missile.png)\n", "\n", "## BV exercises\n", "\n", "12.2, 12.3" ] } ], "metadata": { "@webio": { "lastCommId": null, "lastKernelId": null }, "hide_input": false, "jupytext": { "formats": "ipynb,qmd" }, "kernelspec": { "display_name": "Julia 1.9.3", "language": "julia", "name": "julia-1.9" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.9.3" }, "toc": { "colors": { "hover_highlight": "#DAA520", "running_highlight": "#FF0000", "selected_highlight": "#FFD700" }, "moveMenuLeft": true, "nav_menu": { "height": "87px", "width": "252px" }, "navigate_menu": true, "number_sections": true, "sideBar": true, "skip_h1_title": true, "threshold": 4, "toc_cell": false, "toc_section_display": "block", "toc_window_display": false, "widenNotebook": false } }, "nbformat": 4, "nbformat_minor": 4 }