Linear dependenceAre the following vectors linearly dependent?[1,2,3,4], [1,-2,3,-4], [1,0,1,0]restart;with(LinearAlgebra):equivalent command: a:=Vector([1,2,3,4]);a:=<1,2,3,4>b:=<1,-2,3,-4>c:=<1,0,1,0>zero:=Ca*a+Cb*b+Cc*c;# {seq(zero[i]=0,i=1..4)};eqs:=[seq(zero[i]=0,i=1..4)];solve(eqs,{Ca,Cb,Cc});M:=<a|b|c>Rank(M)Linear dependenceAre the following vectors in C linearly dependent?[I, 1], [1 + i, 1 - i]restart;with(LinearAlgebra):a:=Vector([I,1]);b:=Vector([1+I,1-I]);zero:=Ca*a+Cb*b;eqs:=[seq(zero[i]=0,i=1..2)];solve(eqs,{Ca,Cb});M:=<a|b>Rank(M)BasisConsider a linear space of functions of x\342\210\210[0,2\317\200] with basis {1,cos(x), cos(2x), cos(3x),...}.Can function cos\302\262(x) be expressed in this basis?restart;yes:expand(cos(2*x)/2+1/2);Gram\342\200\223Schmidt orthogonalization - vectors in 3DFind an orthonormal basis in 3D so that (1,1,1)/sqrt(3) is one of its basis vectors.restart;with(LinearAlgebra):b[1]:=Vector([1,1,1])/sqrt(3);More possibilities here ... there are many such basesb[2]:=Vector([1,0,0]);b[2]:=b[2]-(b[1].b[2])*b[1];b[2]:=b[2]/Norm(b[2],Euclidean);b[3]:=Vector([0,1,0]);b[3]:=b[3]-(b[1].b[3])*b[1]-(b[2].b[3])*b[2];b[3]:=b[3]/Norm(b[3],Euclidean);b[1].b[3]; b[2].b[3]; b[1].b[2];b[1].b[1]; b[2].b[2]; b[3].b[3];Gram\342\200\223Schmidt orthogonalization - complex vector spaceFind all orthonormal bases {(b[1], b[2]} in C^2 for b[1]=(1, i)/sqrt(2).Few notes firstrestart; with(LinearAlgebra):Note: Hermitean conjugate (mathematics: \342\200\240, Maple: ^*) and transposition (mathematics: T, Maple: ^+) of vectors in C^nVector([I,0]); Vector([I,0])^*; Vector([I,0])^+;Note: in C^n, Maple automatically performs Hermitean conjugate of the left vector in the dot product:Vector([I,0]).Vector([I,0]); Vector([I,0])^*.Vector([I,0]); Vector([I,0])^+.Vector([I,0]);Let's solveb[1]:=Vector([1,I])/sqrt(2);norm(B[1],2);b[2]:=Vector([1,0]);b[2]:=b[2]-(b[2].b[1])*b[1];b[2]:=b[2]/norm(b[2],2);b[1].b[2];assume(a::real)multiplication by any scalar s\342\210\210C, |s|=1, gives equivalent b[2]b[2]:=b[2]*exp(I*a);b[1].b[2];b[2].b[2]Gram\342\200\223Schmidt orthogonalization - functionsConsider scalar product defined with weight exp(\342\210\222x2); i.e., a\342\213\205b=\342\210\253a(x) b(x) exp(-x2) dxFind several first vectors of a basis generated by orthonormalization of {1, x , x2, x3...}restart;norm() means something else in Maple, to use it for my norm:local norm;scal:=(f,g)->int(f*g*exp(-x^2),x=-infinity..infinity);test - Gauss integralscal(1,1);my norm in the space of functionsnorm:=f->sqrt(scal(f,f));b0:=1: b0:=b0/norm(b0);b1:=x;b1:=b1-scal(b0,b1)*b0;b1:=b1/norm(b1);b2:=x^2;b2:=b2-scal(b0,b2)*b0-scal(b1,b2)*b1;b2:=b2/norm(b2);b3:=x^3;b3:=b3-scal(b0,b3)*b0-scal(b1,b3)*b1-scal(b2,b3)*b2;b3:=b3/norm(b3);b4:=x^4;b4:=b4-scal(b0,b4)*b0-scal(b1,b4)*b1-scal(b2,b4)*b2-scal(b3,b4)*b3;b4:=b4/norm(b4);with(plots): R:=-2..2:p0:=plot(b0,x=R,color=red):p1:=plot(b1,x=R,color=blue):p2:=plot(b2,x=R,color=green):p3:=plot(b3,x=R,color=black):p4:=plot(b4,x=R,color=magenta):display({p0,p1,p2,p3,p4});Functions exp(\342\210\222x^2/2)*bi = \317\210i(x) of quantum harmonic oscillator, are orthonormal with weight 1R:=-5..5:p0:=plot(exp(-x^2/2)*b0,x=R,color=red):p1:=plot(exp(-x^2/2)*b1,x=R,color=blue):p2:=plot(exp(-x^2/2)*b2,x=R,color=green):p3:=plot(exp(-x^2/2)*b3,x=R,color=black):p4:=plot(exp(-x^2/2)*b4,x=R,color=magenta):display({p0,p1,p2,p3,p4});Note: bi = Hermite polynomials (but multiplicative factors)simplify(HermiteH(4,x)/b4);Unitary matrixVerify that matrix U (see below) is unitary.restart;with(LinearAlgebra):U:=Matrix([[1,I],[1,-I]])/sqrt(2);Note: ^* = HermiteanTranspose, ^+=TransposeU^*;U^*.U;U.U^*;Determinant(U); abs(%);Matrix inversionInvert matrix A (see below) and verify that A.A^-1 gives the identity matrix.Solve equation A.x=b for b=(1,1,1)^T.restart;with(LinearAlgebra):A:=Matrix([[1,2,1],[3,-1,2],[-1,1,0]]);invA:=A^(-1);C:=A.invA;b:=Vector([1,1,1]);x:=invA.b;A.x;Rotation in 2DWrite a matrix of rotation by angle \316\261 and calculate its determinant.restart; with(LinearAlgebra):A:=Matrix([[cos(alpha),-sin(alpha)],[sin(alpha),cos(alpha)]]);Determinant(A);simplify(%);simplify(A^+.A);simplify(A.A^+);Rotation in 3DWrite a matrix of rotation by angle \316\261 around vector (a,b,c).restart; with(LinearAlgebra):# assume(a::real): assume(b::real): assume(c::real):r:=sqrt(a^2+b^2+c^2):theta:=arccos(c/r):phi:=arctan(b,a):rotation by \317\206 around zR1:=Matrix([[cos(phi),-sin(phi),0],[sin(phi),cos(phi),0],[0,0,1]]);rotation by \316\270 around y (note the sign - obtained fom R1 by cyclic transformation x\342\206\222y\342\206\222z\342\206\222x)R2:=Matrix([[cos(theta),0,sin(theta)],[0,1,0],[-sin(theta),0,cos(theta)]]);rotation by \316\261 around zR3:=Matrix([[cos(alpha),-sin(alpha),0],[sin(alpha),cos(alpha),0],[0,0,1]]);compose from rightR:=R1.R2.R3.R2^(-1).R1^(-1):simplify(%);test - should be unitarysimplify(Determinant(R));simplify(R^+.R);numerical testa:=1: b:=-3/2: c:=1/2: alpha:=Pi/6;R[1,1]test - should be unity (12\316\261=2\317\200)simplify(R^12);v[0]:=Vector([1,1,2/3]):for i from 1 to 11 do v[i]:=evalf(R.v[i-1]): printf("%g %g %g\134n",v[i][1],v[i][2],v[i][3]): end do:plots[pointplot3d]([seq(v[i],i=0..11)],color=black);