Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hw2 done #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 201 additions & 0 deletions HW2.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Ahmet Ercan Tekden\n",
"### 2012400159\n",
"\n",
"# Hw 2\n",
"\n",
"Vector and matrix p-norms are related by various inequalities, often involving the dimensions m or n. For each of the following, verify the inequality and give an example of a nonzero vector or matrix (for general m,n) for which equality is achieved. In this problem x is a m-vector and A is a m × n matrix."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"**(a)** $\\|x\\|_{\\infty} \\leq \\|x\\|_{2} $\n",
"\n",
"* (1) $\\|x\\|_{2} = \\sqrt{x_1^2+x_2^2+ ... +x_n^2} $\n",
"* (2) $ \\|x\\|_{\\infty} = max\\{|x_1|,|x_2|,..|x_n|\\} $\n",
"* (3) $ \\sqrt{x_1^2+x_2^2+ ... +x_n^2} \\ge |x_i|$ for all $ 1\\leq i \\leq n $\n",
"* (4) $ \\implies \\|x\\|_{\\infty} \\leq \\|x\\|_{2} $\n",
"\n",
"** ex: ** \n",
"\n",
"\\begin{equation}\n",
" x =\n",
" \\begin{bmatrix}\n",
" 1 \\\\\n",
" 2\n",
" \\end{bmatrix}\n",
"\\end{equation}\n",
"\n",
"$ \\|x\\|_2 = \\sqrt{2^2+1^2} = 2.2360679775 $\n",
"\n",
"$ \\|x\\|_{\\infty} = max\\{2,1\\}= 2 $\n",
"\n",
"$ \\|x\\|_{\\infty} = 2 \\leq \\|x\\|_2 = 2.2360679775 $"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"**(b)** $\\|x\\|_{2} \\leq \\sqrt{m} \\|x\\|_{\\infty}$\n",
"\n",
"* (1) $ \\exists{j}$ where $|x_{j}|=max\\{|x_1|,|x_2|,..|x_n|\\} $\n",
"* (2) $ \\forall{x_i}$ we can say $x_i^2=x_j^2-b_i$ where $ 0 \\leq b_i \\leq x_j^2$ $\\implies \\|x\\|_{2}= \\sqrt{m*x_i^2 - \\sum{b_i}} \\leq \\sqrt{m}*x_i $ for any $x_i$\n",
"* (3) $ \\|x\\|_{2} \\leq \\sqrt{m}*x_i$ for any $x_i \\implies \\|x\\|_{2} \\leq \\sqrt{m} \\|x\\|_{\\infty} $\n",
"\n",
"** ex: ** \n",
"using x in (a) ,\n",
"\n",
"$ \\|x\\|_2 = \\sqrt{2^2+1^2} = 2.2360679775 $\n",
"\n",
"$ \\sqrt{2} \\|x\\|_{\\infty} = 1.41421356237 * max\\{2,1\\}= 2.82842712 $\n",
"\n",
"$ \\|x\\|_2 = 2.2360679775 \\leq \\sqrt{m} * \\|x\\|_{\\infty} = 2.82842712 $"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"**(c)** $\\|A\\|_{\\infty} \\leq \\sqrt{n} \\|A\\|_{2}$\n",
"\n",
"If we multiply A with n-vector y we get Ay which is a m-vector. From here we can get following 2 equation.\n",
"\n",
"* (1) $\\|Ay\\|_{\\infty} \\leq \\|Ay\\|_2 $ using (a)\n",
"* (2) $\\|y\\|_2 \\leq \\sqrt{n} \\|y\\|_{\\infty} $ using (b)\n",
"\n",
"If we multiply equations we get \n",
"\n",
"* (3) $ \\|Ay\\|_{\\infty} * \\|y\\|_2 \\leq \\|Ay\\|_2 * \\sqrt{n} \\|y\\|_{\\infty} $\n",
"\n",
"if we divide both sides with $ \\|y\\|_2 * \\|y\\|_{\\infty} $ we get following equation\n",
"\n",
"* (4) $ \\|Ay\\|_{\\infty} \\mathbin{/} \\|y\\|_{\\infty} \\leq \\sqrt{n} * \\|Ay\\|_2 \\mathbin{/} \\|y\\|_2 $\n",
"\n",
"since $ \\|A\\|_2= \\|Ay\\|_2 \\mathbin{/} \\|y\\|_2 $ and $ \\|A\\|_{\\infty}= \\|Ay\\|_{\\infty} \\mathbin{/} \\|y\\|_{\\infty} $\n",
"\n",
"we can see that (4) becomes\n",
"\n",
"* (5) $\\|A\\|_{\\infty} \\leq \\sqrt{n} \\|A\\|_{2}$\n",
"\n",
"** ex ** \n",
"\n",
"\\begin{equation}\n",
" A =\n",
" \\begin{bmatrix}\n",
" 1 & 3 & 4\\\\\n",
" 2 & 1 & 1\n",
" \\end{bmatrix}\n",
"\\end{equation}\n",
"\n",
"\n",
"$ \\|A\\|_2= 5.4271 $\n",
"\n",
"$ \\|A\\|_{\\infty}= 8.0000 $\n",
"\n",
"$ \\|A\\|_{\\infty} = 8.0000 \\leq \\sqrt{n} \\|A\\|_{2} = 1.73205080757 * 5.4271 = 9.40001293776 $\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"**(d)** $\\|A\\|_{2} \\leq \\sqrt{m}\\|A\\|_{\\infty}$\n",
"\n",
" just like (c) buth we use following equations instead\n",
" \n",
"* (1) $\\|y\\|_{\\infty} \\leq \\|y\\|_2 $ using (a)\n",
" \n",
"* (2) $\\|Ay\\|_2 \\leq \\sqrt{m} \\|Ay\\|_{\\infty} $ using (b) (Ay is m-vector unlike y which is n-vector)\n",
" \n",
"If we multiply equations we get \n",
"\n",
"* (3) $ \\|Ay\\|_2 * \\|y\\|_{\\infty} \\leq \\sqrt{m} * \\|Ay\\|_{\\infty} \\|y\\|_2 $\n",
"\n",
"if we divide both sides with $ \\|y\\|_2 * \\|y\\|_{\\infty} $ we get following equation\n",
"\n",
"* (4) $ \\|Ay\\|_2 \\mathbin{/} \\|y\\|_2 \\leq \\sqrt{m} * \\|Ay\\|_{\\infty} \\mathbin{/} \\|y\\|_{\\infty} $\n",
"\n",
"since $ \\|A\\|_2= \\|Ay\\|_2 \\mathbin{/} \\|y\\|_2 $ and $ \\|A\\|_{\\infty}= \\|Ay\\|_{\\infty} \\mathbin{/} \\|y\\|_{\\infty} $\n",
"\n",
"we can see that (4) becomes\n",
"\n",
"* (5) $\\|A\\|_{2} \\leq \\sqrt{m}\\|A\\|_{\\infty}$\n",
"\n",
"** ex ** \n",
"\n",
"using same A as (c)\n",
"\n",
"\\begin{equation}\n",
" A =\n",
" \\begin{bmatrix}\n",
" 1 & 3 & 4\\\\\n",
" 2 & 1 & 1\n",
" \\end{bmatrix}\n",
"\\end{equation}\n",
"\n",
"\n",
"$ \\|A\\|_2= 5.4271 $\n",
"\n",
"$ \\|A\\|_{\\infty}= 8.0000 $\n",
"\n",
"$ \\|A\\|_{2} = 5.4271 \\leq \\sqrt{m}\\|A\\|_{\\infty} = 1.73205080757 * 8.0000 = 13.8564064606 $\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Octave",
"language": "octave",
"name": "octave"
},
"language_info": {
"file_extension": ".m",
"help_links": [
{
"text": "GNU Octave",
"url": "https://www.gnu.org/software/octave/support.html"
},
{
"text": "Octave Kernel",
"url": "https://github.com/Calysto/octave_kernel"
},
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-octave",
"name": "octave",
"version": "4.2.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}