Application Center - Maplesoft

App Preview:

Classroom Tips and Techniques: Norm of a Matrix

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application




Classroom Tips and Techniques:

Norm of a MatrixNULL

NULL

Robert J. Lopez

Emeritus Professor of Mathematics - Rose Hulman Institute of Technology

Maple Fellow - Maplesoft

NULL

Introduction

NULL

The greatest benefits from bringing Maple into the classroom are realized when the static pedagogy of a printed textbook is enlivened by the interplay of symbolic, graphic, and numeric calculations made possible by technology.  It is not enough merely to compute or check answers with Maple.  To stop after noting that indeed, Maple can compute the correct answer is not a pedagogical breakthrough.

 

Getting Maple to compute the correct answer is just the first step.  Using Maple to bring insights not easily realized with by-hand calculations should be the goal of everyone who sets a hand to improving the learning experiences of students.

 

For example, let's look at how the notion of a matrix norm might be taught in a Maple environment.  In particular, let's consider the definition

 

LinearAlgebra[Norm](A) = max*{LinearAlgebra[Norm](A*x)}, LinearAlgebra[Norm](x) = 1

NULL

where the vector norm || A x || is the Euclidean, or 2-norm, so that || A || is actually LinearAlgebra[Norm](A, 2), the 2-norm of the matrix A.

 

First we will show that Maple easily computes LinearAlgebra[Norm](A, 2), then we'll show how Maple can be used to gain some insight into just what this number means.

NULL

Initialize

NULL

• 

Tools_Load Package: Student Calculus 1

Loading Student:-Calculus1

• 

Tools_Load Package: Student Multivariate Calculus

Loading Student:-MultivariateCalculus

• 

Matrix palette: 2×2 matrix template
Type entries and use Tab key to move through fields.

• 

Context Menu: Assign to a Name_A

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4})"(->)"A

• 

Matrix palette: 2×1 matrix template for vector
Type entries and use Tab key to move through fields.

• 

Context Menu: Assign to a Name_U

Vector(2, {(1) = cos(t), (2) = sin(t)})"(->)"U

NULL

Preliminary Views

NULL

In Figure 1, the surface represents the Euclidean norm of A*V, that is,

 

LinearAlgebra[Norm](A*V) = sqrt(10*x^2+28*x*y+20*y^2)

``

where V = i*x+j*y. The black curve drawn in the surface is the intersection of the surface with the lift of the unit circle up to the surface. The norm of A is the maximum of LinearAlgebra[Norm](A*V) on the unit circle, that is, along the black curve traced in the surface.

 

In Figure 2, the slider controls the value of theta for the unit vector u = cos(theta)*i+sin(theta)*i. As u rotates around the unit circle, the green vector, A*u, grows and shrinks. The length of the vector A*u is displayed beneath the slider. The norm of A itself is the length of the longest green vector. In other words, Figure 2 demonstrates that the norm of a matrix is the largest factor by which the length of a unit vector can be changed by the matrix.

NULL

use plots, Student:-LinearAlgebra in
module()
local A,V,U,N,f,p1,p2,p3;
A:=Matrix(2,2,[1,2,3,4]);
V:=<x,y>;
U:=<cos(t),sin(t)>;
N:=Norm(A.U,2);
f:=simplify(Norm(A.V,2));
p1:=spacecurve([cos(t),sin(t),N],t=0..2*Pi,color=black,thickness=2);
p2:=plot3d(f,x=-1.1..1.1,y=-1.1..1.1,view=0..6,axes=frame,transparency=.4,style=surface,color=cyan);
p3:=display(p1,p2,orientation=[20,70,0],tickmarks=[3,3,6]);
print(p3);
end module:
end use:

 

Figure 1   Norm of AV and the lift of the unit circle

NULL

 "theta   ="  =  

 "||Au||="     

Figure 2   Unit vector u (in black); A*u (in green)

``

Obtain the Euclidean Norm of A

NULL

Table 1 demonstrates how to obtain the Euclidean norm of A by syntax-free methods in Maple. The chief tool is the Context Menu system.

 

• 

Type A, the name of the matrix.
Context Menu: Evaluate and Display Inline

• 

Context Menu: Norm_Euclidean

• 

Context Menu: Approximate_10 (digits)

A = Matrix([[1, 2], [3, 4]])"(->)"(15+221^(1/2))^(1/2)"(->)"5.464985704

Table 1   Syntax-free calculation of LinearAlgebra[Norm](A), the Euclidean norm of A

NULL

Matrix Norm from First Principles

NULL

In Table 2, LinearAlgebra[Norm](A), the Euclidean norm of A, is obtained via first principles.

 

For the product A*U, obtain LinearAlgebra[Norm](A*U), its Euclidean norm, and a graph of LinearAlgebra[Norm](A*U)

• 

Write the product of A and U, using a period for noncommutative multiplication; press the Enter key.

• 

Context Menu: Student Multivariate Calculus_Norm

• 

Context Menu: Simplify_Simplify

• 

Context Menu: Plots_Plot Builder (Set `in`(t, [0, 2*Pi]).)

A.U

Vector[column]([[cos(t)+2*sin(t)], [3*cos(t)+4*sin(t)]])

(1)

"(->)"

((cos(t)+2*sin(t))^2+(3*cos(t)+4*sin(t))^2)^(1/2)

(2)

"(=)"

(-10*cos(t)^2+28*cos(t)*sin(t)+20)^(1/2)

(3)

"->"

NULL

``

Set the derivative of LinearAlgebra[Norm](A*U) to zero and solve for t[max]

• 

Calculus palette: Differentiation operator
Reference LinearAlgebra[Norm](A*U) by its equation label

• 

Context Menu: Student Calculus 1_Solve_Find Roots
Complete Roots dialog as per figure to the right.

• 

Context Menu:Select Element_1

NULL

diff((-10*cos(t)^2+28*cos(t)*sin(t)+20)^(1/2), t) = 0

(1/2)*(20*cos(t)*sin(t)-28*sin(t)^2+28*cos(t)^2)/(-10*cos(t)^2+28*cos(t)*sin(t)+20)^(1/2) = 0

(4)

"(->)"

[arctan(5/14+(1/14)*221^(1/2))]

(5)

"(->)"

arctan(5/14+(1/14)*221^(1/2))

(6)

Substitute t[max] into LinearAlgebra[Norm](A*U) to obtain LinearAlgebra[Norm](A) 

• 

Expression palette: Evaluation template (Reference LinearAlgebra[Norm](AU) and t[max] by equation label.)
Context Menu: Label_Label Reference

• 

Press the Enter key.

• 

Context Menu: Simplify_Simplify

• 

Context Menu: Approximate_10 (digits)

eval((-10*cos(t)^2+28*cos(t)*sin(t)+20)^(1/2), t = arctan(5/14+(1/14)*221^(1/2)))

(-10/(1+(5/14+(1/14)*221^(1/2))^2)+28*(5/14+(1/14)*221^(1/2))/(1+(5/14+(1/14)*221^(1/2))^2)+20)^(1/2)

(7)

"(=)"

2*(1105+74*221^(1/2))^(1/2)/(221+5*221^(1/2))^(1/2)

(8)

"(->)"

5.464985704

(9)

Table 2   Calculation of LinearAlgebra[Norm](A) from first principles

NULL

Alternate Approaches

NULL

An alternate approach treats the calculation of LinearAlgebra[Norm](A) as a constrained optimization problem, where the objective function is LinearAlgebra[Norm](A*V) and the constraint is the equation LinearAlgebra[Norm](V) = 1. Table 3 uses the Context Menu to implement a numeric optimization based on the Maximize  command in the Optimization package.

 

• 

Write the sequence of objective function and constraint equation, then press the Enter key.

• 

Context Menu: Optimization_Maximize (local)

LinearAlgebra[Norm](A.`<,>`(x, y)), x^2+y^2 = 1

((x+2*y)^2+(3*x+4*y)^2)^(1/2), x^2+y^2 = 1

"(->)"

[5.46498570421913055, [x = HFloat(0.5760484369224957), y = HFloat(0.8174155603603235)]]

Table 3   Numeric solution of a constrained optimization problem

 

The first number in the returned list is the maximum of the objective function, hence, the norm of the  matrix A. The second member of that list is a list of equations specifying x[max] and y[max].

NULL

The symbolic equivalent of the numeric calculation in Table 3 is realized in Table 4 where the Lagrange Multiplier method is implemented.  It is surprisingly "messy," especially since there are multiple solutions that have to be sorted out.

 

Obtain x[max] and y[max] via the Lagrange Multiplier method

• 

Write the function g*lambda+f, where f is the objective function and g is the constraint; press the Enter key.

• 

Calculus palette: Partial-derivative operator (Differentiate with respect to x, y, and lambda; press the Enter key.)

• 

Context Menu: Solve_Solve (explicit)

LinearAlgebra[Norm](A.`<,>`(x, y))+lambda*(x^2+y^2-1)

((x+2*y)^2+(3*x+4*y)^2)^(1/2)+lambda*(x^2+y^2-1)

(10)

diff(((x+2*y)^2+(3*x+4*y)^2)^(1/2)+lambda*(x^2+y^2-1), x) = 0, diff(((x+2*y)^2+(3*x+4*y)^2)^(1/2)+lambda*(x^2+y^2-1), y) = 0, diff(((x+2*y)^2+(3*x+4*y)^2)^(1/2)+lambda*(x^2+y^2-1), lambda) = 0

(1/2)*(20*x+28*y)/((x+2*y)^2+(3*x+4*y)^2)^(1/2)+2*lambda*x = 0, (1/2)*(28*x+40*y)/((x+2*y)^2+(3*x+4*y)^2)^(1/2)+2*lambda*y = 0, x^2+y^2-1 = 0

(11)

"(->)"

{lambda = -(1/4)*34^(1/2)+(1/4)*26^(1/2), x = (1/442)*(97682+1105*34^(1/2)*26^(1/2))^(1/2), y = (1/3094)*(97682+1105*34^(1/2)*26^(1/2))^(1/2)*(2*(-(1/4)*34^(1/2)+(1/4)*26^(1/2))^2-5)}, {lambda = -(1/4)*34^(1/2)+(1/4)*26^(1/2), x = -(1/442)*(97682+1105*34^(1/2)*26^(1/2))^(1/2), y = -(1/3094)*(97682+1105*34^(1/2)*26^(1/2))^(1/2)*(2*(-(1/4)*34^(1/2)+(1/4)*26^(1/2))^2-5)}, {lambda = -(1/4)*34^(1/2)-(1/4)*26^(1/2), x = (1/442)*(97682-1105*34^(1/2)*26^(1/2))^(1/2), y = (1/3094)*(97682-1105*34^(1/2)*26^(1/2))^(1/2)*(2*(-(1/4)*34^(1/2)-(1/4)*26^(1/2))^2-5)}, {lambda = -(1/4)*34^(1/2)-(1/4)*26^(1/2), x = -(1/442)*(97682-1105*34^(1/2)*26^(1/2))^(1/2), y = -(1/3094)*(97682-1105*34^(1/2)*26^(1/2))^(1/2)*(2*(-(1/4)*34^(1/2)-(1/4)*26^(1/2))^2-5)}

(12)

Substitute x[max] and y[max] into LinearAlgebra[Norm](A.`<,>`(x, y)) to determine LinearAlgebra[Norm](A) 

• 

Expression palette: Evaluation template (Evaluate LinearAlgebra[Norm](A.`<,>`(x, y)) at the third solution and press the Enter key.

• 

Context Menu: Simplify_Simplify

• 

Context Menu:_Approximate_10 (digits)

eval(LinearAlgebra[Norm](A.`<,>`(x, y)), ({lambda = -(1/4)*34^(1/2)+(1/4)*26^(1/2), x = (1/442)*(97682+1105*34^(1/2)*26^(1/2))^(1/2), y = (1/3094)*(97682+1105*34^(1/2)*26^(1/2))^(1/2)*(2*(-(1/4)*34^(1/2)+(1/4)*26^(1/2))^2-5)}, {lambda = -(1/4)*34^(1/2)+(1/4)*26^(1/2), x = -(1/442)*(97682+1105*34^(1/2)*26^(1/2))^(1/2), y = -(1/3094)*(97682+1105*34^(1/2)*26^(1/2))^(1/2)*(2*(-(1/4)*34^(1/2)+(1/4)*26^(1/2))^2-5)}, {lambda = -(1/4)*34^(1/2)-(1/4)*26^(1/2), x = (1/442)*(97682-1105*34^(1/2)*26^(1/2))^(1/2), y = (1/3094)*(97682-1105*34^(1/2)*26^(1/2))^(1/2)*(2*(-(1/4)*34^(1/2)-(1/4)*26^(1/2))^2-5)}, {lambda = -(1/4)*34^(1/2)-(1/4)*26^(1/2), x = -(1/442)*(97682-1105*34^(1/2)*26^(1/2))^(1/2), y = -(1/3094)*(97682-1105*34^(1/2)*26^(1/2))^(1/2)*(2*(-(1/4)*34^(1/2)-(1/4)*26^(1/2))^2-5)})[3])

(((1/442)*(97682-1105*34^(1/2)*26^(1/2))^(1/2)+(1/1547)*(97682-1105*34^(1/2)*26^(1/2))^(1/2)*(2*(-(1/4)*34^(1/2)-(1/4)*26^(1/2))^2-5))^2+((3/442)*(97682-1105*34^(1/2)*26^(1/2))^(1/2)+(2/1547)*(97682-1105*34^(1/2)*26^(1/2))^(1/2)*(2*(-(1/4)*34^(1/2)-(1/4)*26^(1/2))^2-5))^2)^(1/2)

(13)

"(=)"

(15+17^(1/2)*13^(1/2))^(1/2)

(14)

"(->)"

5.464985704

(15)

Table 4   Symbolic calculation of LinearAlgebra[Norm](A) by the Lagrange Multiplier method

NULL

NULL

NULL

NULLNULL

Legal Notice: © Maplesoft, a division of Waterloo Maple Inc. 2017. Maplesoft and Maple are trademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profit activities.