#linear-algebra

2 messages Ā· Page 298 of 1

twilit minnow
#

so my question is

subtle gust
#

Both sided invertible? šŸ’€

twilit minnow
#

how can i go from rank(A) = n to injective

lavish jewel
#

wait what

#

let's run that again

twilit minnow
#

with the transformation T

zinc timber
lavish jewel
#

this is only true if m = n, gta

zinc timber
subtle gust
#

Isn't the def of an inverse AB=BA=In?...

lavish jewel
#

if m < n, you cannot have rank n

subtle gust
#

Why would it matter

lavish jewel
#

and if m > n, you have a nontrivial kernel

twilit minnow
#

if m > n, it is injective

lavish jewel
#

you need to rework this part

subtle gust
#

If we multiply by the inv from the right or the left

zinc timber
#

so may ppl so may topic lol

lavish jewel
#

if m > n and rank n, you don't have injectivity

#

just say rank(A) = m

twilit minnow
#

wait how?

twilit minnow
#

you have

#

full col rank

#

how isnt it injective

lavish jewel
#

what size is your matrix

twilit minnow
#

mxn where m > n

#

just any tall matrix

lavish jewel
#

the image you shared says n x m

#

that's what i was talking about

twilit minnow
#

B is n x m

#

A is m x n

zinc timber
lavish jewel
#

ffs i can't read

#

carry on

zinc timber
twilit minnow
#

i dont know if saying the rank nullity is 0 is enough

#

is it

zinc timber
#

just nullity, not rank nullity and yes it's enough

twilit minnow
#

okay then how do we go from injective to at least one left inverse

#

i read some answers online but i just got confused

zinc timber
#

I can give one informal construction

#

you can find a nxn matrix (say B') from im(A) -> R^n s.t. B'A = Id, now extend the rows till they have length m

twilit minnow
#

how would you do it in a formal proof

zinc timber
#

well your (A'A)^-1 A' is a left inverse

#

just show (A'A) is invertible when rankA = n

meager harness
#

<@&286206848099549185> 4b?

lavish jewel
#

please don't ping helpers immediately

#

what have you tried?

gritty swift
#

my solution: let $e_1,\dots,e_m$ be an orthonormal basis of $V$ with respect to $\langle \cdot, \cdot\rangle_1$. then we have
$$\langle v,w\rangle_1 = \sum a_jb_j$$
and
$$\langle v,w\rangle_2 = \sum a_jb_j |e_j|_2^2$$
now to show every $|e_j|_2$ is the same I derive a contradiction assuming they're different (i.e. if the sum is weighted I construct v,w such that the inner products disagree on orthogonality, which they can't). but this feels like an ugly solution and doesn't give insight. can anyone think of something better?

stoic pythonBOT
spare widget
#

why would <.,.>_1 = sum ...

#

It doesn't even say that the spaces are finite dimensional

gritty swift
#

they are

spare widget
#

Nor does it say that your inner product is the dot product

gritty swift
#

with an orthonormal basis it becomes the dot product

spare widget
#

It could very well be u^T M u

spare widget
#

They can plug in any symmetric positive definite form

#

I think you should use only what they provide

gritty swift
#

ok I'll try without assuming finite-dim, the section is "orthonormal bases" and all the other exercises assume finite-dim so I guess I assumed it

spare widget
#

my point is not about finite dim

#

It's fine if they say it's finite dim

#

What isn't fine is you writing it as sum_i a_ib_i

gritty swift
#

it's correct because $\langle e_j, e_j\rangle_1 = 1$

stoic pythonBOT
gritty swift
#

the second one is the one that might be weighted (though you can show it's not)

spare widget
#

the following is a perfectly valid inner product <u,v> = u^T G v

gritty swift
#

I know

spare widget
#

G positive definite

gritty swift
#

we wrote $v = \sum a_j e_j$ and $w = \sum b_j e_j$ so $\langle v,w\rangle_1 = \sum a_jb_j$

#

expand it out

stoic pythonBOT
spare widget
#

They never define <v,w>_1 = \sum_i a_i b_i

gritty swift
#

that isn't a definition it's a consequence oml

spare widget
#

a consequence of what

gritty swift
#

$$
\langle v, w\rangle_1 = \sum_i \sum_j a_jb_j\langle e_i, e_j\rangle
$$

stoic pythonBOT
gritty swift
#

and the orthonormality of $e_i$

stoic pythonBOT
spare widget
#

^ they never define it like this

gritty swift
#

I defined e_i

spare widget
#

I can define an inner product in an orthonormal basis that includes a non-identity matrix

gritty swift
#

the orthonormal basis is picked with respect to <*, *>1

spare widget
#

So you picked the basis G^{-1/2}?

gritty swift
#

I'm considering the inner product space (V, <*, *>_1)

#

we aren't dealing with matrices here just linear maps

spare widget
#

It's isomorphic in fin dim

#

R^n to your V

gritty swift
#

yeah I guess, I'm not very familiar with the matrix definition of inner products

spare widget
#

but ok, I am starting to get what you mean

gritty swift
#

anyway the thing I was asking was is there a nice way to show $|e_k|_2 = |e_j|_2$

stoic pythonBOT
gritty swift
#

the way I showed it was assume $|e_k|_2 \ne |e_j|_2$ then exploit the unequal weighting to find $v,w$ such that $\langle v,w\rangle_1 = 0$ and $\langle v,w\rangle_2 \ne 0$ (a contradiction)

stoic pythonBOT
gritty swift
#

we haven't defined matrix sqrts or the matrix defn of inner products btw, though i'd be happy to hear a proof in that form if its intuitive

#

in matrix form I think the exercise would be: given that $x^TAy = 0$ if and only if $x^TBy = 0$ (where $A,B$ are positive definite) show that $A = cB$ for some scalar $c$

stoic pythonBOT
zinc timber
#

x'(A-B)y=0

spare widget
#

you plug in x,y the basis vecs

#

And you get the entries

#

Up to a multiplicative factor

zinc timber
#

^

spare widget
#

wait, does that work

zinc timber
gritty swift
#

it leads to the same thing I ended up with I think

#

this was kinda silly question its intuitive enough as it is that an unequal weighting implies you can make one zero and the other not

zinc timber
#

consider orthonormal basis wrt A

spare widget
#

I still think there should be a much simpler way

zinc timber
#

you get that the orthonormal basis is also a orthogonal basis of B, not necessarily of unit length

gritty swift
#

ooh

#

I had an idea

#

define a third inner product $\langle v,w\rangle_3 = \langle v,w\rangle_1 - \langle v,w\rangle_2$

stoic pythonBOT
spare widget
#

Afaik |ej|^2 = |ek|^2 wrt <>_2 is not true,is it?

zinc timber
#

it's not

#

i only said orthogonal not orthonormal

zinc timber
#

that we have to prove separately

gritty swift
#

yeah nvm

#

its only an inner product if c /= 0 otherwise its identically zero

spare widget
#

I was thinking more along the lines of {v}^{perp} = {w : <v,w>_1 =0 } = { w: <v,w>_2 = 0}

#

i.e. the orthogonal complement to the span of v wrt both inner products is the same

#

And any vector can then be decomposed in this

#

I didn't think of how to continue this though

#

It should use somewhere that it's for every v

gritty swift
#

oh wait I'm dumb

spare widget
#

In order to get that the constant is tge same

gritty swift
#

I think you can use this somehow

#

maybe?

#

its from the same section

spare widget
#

idk how that helps you

gritty swift
#

true

#

I mean you could fix one of v,w then apply it to write both in terms of the same norm

#

it still assumes finite dim though (which is probably correct tho it spooks me he doesn't mention it since he usually does)

#

you can get $\langle v, w\rangle_1 = \langle v, u\rangle_2$ for all $w \in V$ using Riesz

stoic pythonBOT
zinc timber
#

say v1,..,vn orthonormal basis wrt A the these are orthogonal wrt B so a basis. now say Bv1 = āˆ‘ ci vi then v1'Bv1 = c1

spare widget
#

You can try to pick v1,v2 such that <v1,w>_1 = c1<v1,w>_2 and <v2,w>_1 = c2 <v2,w>_2

#

And assume c1!= c2

#

Once you decompose v2 into a part parallel to v1 and orthogonal you can probably get a contradiction

zinc timber
#

let v2'Bv2=c2 similarly then v1'(Bv2-c1v2)=0

spare widget
#

I think the key is that the orthogonal complements to the span of v are the same

zinc timber
#

aah can't type

spare widget
#

Does the following work @gritty swift

#

Let <v1,w>_1 = c1 <v1, w>_2 and <v2,w>_1=c2<v2,w>_2

#

from this you have

#

<v1,v2>_1 = c1<v1,v2>_2 and <v2,v1>_1 = c2<v2,v1>_2 -> c1 = c2

#

from symmetry of the inner product

#

For the <v1,w>_1 = c1<v1,w>_2 part I think it suffices that you take a basis with 1 of the vectors being v1

#

And the others being in the orthogonal complement

gritty swift
#

it seems like it does

#

that's a more elegant way of showing it without a contradiction

#

you get <v1,v2>_1 = c1<v1,v2> from setting w=v2 and the other one from setting w=v1 right (the first line was for all w)

spare widget
#

yes

gritty swift
#

yep I think it works nice

spare widget
#

And v1 and v2 were arbitrary

#

So the c is unique

gritty swift
#

ooh true so it works in infinite dim

spare widget
#

Idk about inf

gritty swift
#

you never assumed you had a spanning list so it should extend

spare widget
gritty swift
#

I mean you're setting c1 = <v1,w>_1 / <v1,w>_2

spare widget
#

Yes, but you have to show that it is a unique c1 for any w

gritty swift
#

so we just need <v1, w> /= 0 and same for c2 right

#

ah right

spare widget
#

which you should be able to do through picking a basis with v1 being 1 of the vectors

#

And the rest being in the orthogonal complement

#

So w gets decomposed in these two parts

#

The orthogonal part resulting in 0

gritty swift
#

yeah makes sense

spare widget
#

I haven't worked out the details though, there may be something missing

viral olive
#

guys if you have a linear function and a linear transformation from V ->V.
Is a set of linear independent lets call them (v1,v2,...,vn) still linear indepedent in the field.
(f(v1),f(v2),.....,f(vn))

spare widget
#

depends on f

viral olive
#

so if f is bijective

#

I assumed yes.
If f is not bijective its clear for me why it woulnt be the case.

spare widget
#

Yes if f is bijective it's all good

viral olive
#

Aight thanks Glados

spare widget
#

You're welcome

spare widget
#

You can use f(sum_i a_i v_i) = f(0) -> sum_i a_i f(v_i) = f(0) = 0

#

Vectors are lin indep if this holds only for (a1,...,an) = (0,...,0)

#

So the only way those can become linearly dependent is if f's kernel is nontivial

#

Because then let b != 0 be a vector from the kernel, and there exists (a1,...,an) != (0,...,0) such that b = \sum_i a_i v_i

#

But f(sum_i a_i v_i) = sum_i a_i f(v_i) = f(b) = 0

#

So by definition f(v1),...,f(vn) are then lin dependent

#

To be more specific, any vector that is in the kernel would become linearly dependent after the map since it goes to 0

#

Lin indep vectors not in the kernel are mapped to lin indep vectors

meager harness
viral olive
#

perfect thank you

oblique prairie
#

just making sure, linearly independent subset here means that all vectors in the subset are linearly independent right?

wintry steppe
#

and the union of all of them is a subset of linearly independent vectors of V

bronze hill
#

Can someone provide a straightforward proof for b) preferrably using latex?(I'm checking my solutions)

spare widget
#

$(C^TA^T){ij} = \sum_k (C)^T{ik} (A)^T_{kj} = \sum_k C_{ki}A_{jk} = \sum_k A_{jk}C_{ki} = (AC){ji} = (AC)^T{ij}$

stoic pythonBOT
#

criver

wise nebula
#

hi guys i have an exam tomorrow and a really fast question about linear algebra

#

can someone come voice with me for a minute or two?

#

really don't know how to type that in the web

spare widget
#

I'd still suggest to try and write it

bronze hill
spare widget
#

How so?

#

The multiplication is defined only if the inner dimension matches

#

so it's safe to omit it

bronze hill
#

Now I got it, thank you.

spare widget
#

The only thing I can think of to avoid any confusion is to write (D)^T_{ij} as (D^T)_{ij} instead, but I think it's understandable even as I wrote it

wintry steppe
#

$V$ and $W$ are two finite dimensional vector spaces, $dim V = n, dim W = m$. Could somebody help me understand why $dim \mathcal{L}(V, W) = n \cdot m$? My textbook gives a proof, but no intuition behind it.

stoic pythonBOT
wintry steppe
#

the set of all linear transformations from $V$ to $W$

stoic pythonBOT
gray dust
#

so the dim of the latter gives the dim of the former

oblique prairie
#

probably just a little unnecessary nitpick, but why is this proof distinguishing between n_i and d_i as if they aren’t equal?

#

n_i = number of vectors in the ordered basis for E_{lambda_i}, d_i = dim(E_{lambda_i})

wintry steppe
#

they aren't

#

they haven't assumed the hypotheses of part (b) yet, they've only assumed that T is diagonalizable

#

they're defining \beta_i here using the same notation as part (b), but they're only proving (a)

oblique prairie
#

oh

#

ok then thanks

wintry steppe
#

šŸ‘

oblique prairie
#

i read it a bit more in depth (at least i think), only paying attention to the stuff from (a), and i still don’t see how those two aren’t equal

#

i mean, B_i is very obviously a basis for E_{lambda_i}

wintry steppe
#

why

oblique prairie
#

well, E_{lambda_i} is a subspace of V, so there must be some subset of the set of basis vectors that generate E_{lambda_i}

wintry steppe
#

i'm not convinced

#

{(1, 0), (0, 1)} is a basis of R^2, but no subset of it generates, say, the line y = x

polar vessel
#

how can i prove that for a matrix A and orthogonal matrix B, |AB|F = |A|F

#

so prove that the frobenius norm of AB equals the frobenius norm of A

dark pier
#

if you multiply two symmetric matrix, is the end result also symmetric?

wintry steppe
#

only if they commute

wintry steppe
#

that might help

dark pier
wintry steppe
#

AB = BA

polar vessel
#

otherwise yeah it would be simple

soft burrow
#

then relate that to the Frobenius norm

polar vessel
#

yeah thats what im trying right now

soft burrow
#

I think it follows more or less by definition

#

since the Frobenius norm is just the Euclidean norm on R^{n^2}

polar vessel
#

for all n?

soft burrow
#

yeah for n x n matrices

soft burrow
polar vessel
#

so for UC = [UC1 UC2 ... UCn] are C1 ... Cn the columns or rows of C

tacit pelican
#

could anyone help with this?

#

for the other questions, they were all based in \mathbb{R}^n so i could either create a matrix with the given vectors

#

and try putting it into rref

#

to see if it is generating or not

#

but i don't understand how to work with a space like $\mathbb{P}_3$

stoic pythonBOT
hardy inlet
#

Ok so if you were in Rⁿ, lets say R², how many vectors are needed (at a minimum) to create a spanning set?

tacit pelican
#

2

hardy inlet
#

Ok

#

So u need at least the dimension of the space itself

tacit pelican
#

yep

hardy inlet
#

(along with linear independence, but ignoring that)

#

Do you know what P3 means?

tacit pelican
#

yes, the space of polynomials of degree at most 3

#

but the dimension is kinda unclear to me, since the standard basis of the space is 1, x, x^2, x^3

#

so does that mean its dimension is 4?

hardy inlet
#

What is the definition of dimension?

#

(and yes its 4)

#

The dimension of vector space V is the number of vectors in a basis for V

tacit pelican
#

thats the next section

#

this section is about analyzing the pivots of a matrix in echelon form

#

so i assume i have to compose some matrix or something to deduce if it is generating or not

#

,rotate

hardy inlet
#

hmm

tacit pelican
#

oh

hardy inlet
#

matrices sadcat

tacit pelican
#

so its just hte number of vectors in its basis?

hardy inlet
#

yes

tribal willow
#

you could make a matrix of the three polynomials and row-reduce them, no?

tacit pelican
#

do i represent these polynomials as vectors somehow?

hardy inlet
#

the coefficients yes

#

ax^0 + bx^1 + cx^2 + dx^3

#

(using the ordered basis of the standard p3 basis)

tacit pelican
#

so for example $x^3 +2x$ is equivalent to the matrix $\begin{pmatrix} 0 \ 2 \ 0 \ 1 \end{pmatrix}$

hardy inlet
#

so x^3 + 2x would be 0 2 0 1

tacit pelican
#

oh wait

#

sorry typo

hardy inlet
#

i dont think u want them as columns

#

but its been a while since i've done raw matrix comps

tribal willow
#

pretty sure it's as rows

tacit pelican
#

oh ok my bad

#

so it would be

tribal willow
#

then you perform elementary row operations on the rows to row-reduce to echelon form

stoic pythonBOT
tribal willow
#

ye

hardy inlet
#

anamono would have to probably verify; but I think u put all 3 coefficient entries as rows in the matrix and row reduce; but you wont get the identity since u dont have 4 rows

tacit pelican
#

how do i combine them into one single matrix though? before, i was just putting the given vectors as the columns of a matrix A

tribal willow
#

i dont think you need to have identity, you just show they're linear independent right?

tacit pelican
#

yeah

tribal willow
#

i forgot condition for span

tacit pelican
#

which means

#

i have to show that there is a pivot in each column

#

i can do that

tribal willow
#

tbh i have never worked with pivots

#

so i can't help you there

hardy inlet
#

this thing i'm reading has column vectors

tacit pelican
#

yeah i got that covered from my notes

#

wait one thing i'm still unsure about is why its a row vector this time

#

when working in $\mathbb{R}^n$

tribal willow
#

hmm

stoic pythonBOT
tribal willow
#

i row reduce my matrices when i construct vectors in rows

#

i wonder if it's something different for columns?

tacit pelican
#

they were $n\times 1$ column vectors

tribal willow
#

or something im just forgetting

stoic pythonBOT
hardy inlet
#

this thing used columns tho

tacit pelican
#

yeah for example, here i just stuffed the four vectors into a matrix so it became $\begin{pmatrix} 1 \ 1 \ 0 \ 0 \ 1 \ 0 \ 0 \ 1 \ 0 \ 1 \ 1 \ 0 \ 0 \ 0 \ 1 \ 1 \end{pmatrix}$

stoic pythonBOT
hardy inlet
#

but that only shows linear independence in that example not span

#

but yeah probably that matrix

#

for 3.2

#

this thing claims u need a 1 in every row

#

so since ur last row on the P3 problem would be 0s its not spanning

tacit pelican
#

i can show that a system of vectors is spanning and/or linearly independent easily

#

but

#

i just need the matrix

#

to represent that system

#

so my confusion here is: why are these polynomials represented as row vectors here? whats different in $\mathbb{P}_3$ compared to $\mathbb{R}^4$

stoic pythonBOT
hardy inlet
#

i think we were just wrong about how to enter them into the matrix

#

so i think u do make them column vectors

#

so it'd be 4x3

#

(4 rows, 3 col)

tacit pelican
#

ahh alright

#

thank you

#

this is what i got

#

just need to row reduce now right?

hardy inlet
#

yea

#

which gives me

tacit pelican
#

got it

hardy inlet
#

so they're linearly independent but don't span because the last row doesn't have a pivot

#

and im pretty sure 3.2 row reduces to the identity

#

so that would be linearly independent and span; hence a basis

tacit pelican
#

yup

#

i got that as well

#

since theres a pivot in each column

#

they're linearly independent

#

alright thank you, that was a big help

hardy inlet
#

i'm only 90% sure on this stuff

#

and i think having pivots in the rows means spans

#

but idk

tacit pelican
#

yeah it does

hardy inlet
#

from my brief research

tacit pelican
#

pivot in every row = generating (spanning)

manic crow
#

Well, I'm new at this, I wanted someone to help me with a question, but seems like it's not going to happen yet, then, can someone tell me please how to solve this or where to find information to solve this?

quartz compass
#

gaussian elimination or reduced row echelon form with an augmented matrix are some keywords to help you get started

humble oak
#

could someone explain to me why $\Bar{v}^T v = ||v||^2$ where v is some non-zero vector

stoic pythonBOT
dusky epoch
#

it works for v = 0 too, so...

#

the standard norm on $\bC^n$ is $\nrm{v} = \sqrt{\sum_{k=1}^n |v_k|^2} = \sqrt{\sum_{k=1}^n \overline{v_k} v_k}$

stoic pythonBOT
humble oak
#

ah okay

#

i see thank you

wintry glen
#

So I've just gone over the section on eigenvalues and linear transformations and I have few questions.

Let T be a transformation from V to V and B be a basis of V. The book defined a B-matrix of T, but I don't seem to understand what the use of it is. Is it just so that we can represent any linear transformation on general vector spaces as a matrix, so as to have a systematic way of computing T(x) by first finding the B-coordinate vector of x, then multiplying by the B-matrix of T, then by converting back the B-coordinate vector of T(x)?

Also, they also discussed how if T is a linear transformation from R^n to R^n with standard matrix A, then if A is diagonalizable, then the B-matrix of T is diagonal, where B is the eigenvector basis given by A. What is the practical significance of this? Is it just saying that if we choose to work in the eigenvector basis that the effect of the transformation is the simplest?

limber sierra
#

The book defined a B-matrix of T, but I don't seem to understand what the use of it is. Is it just so that we can represent any linear transformation on general vector spaces as a matrix?
that's the idea, yes, at least as long as the vector space is finite-dimensional. representing transformations as matrices has its applications (if you've taken calculus, you may be familiar with the Jacobian matrix of a linear function, which tells you information about its local rate of change)

#

and being able to do that wrt a basis is essentially the way we "compensate for different coordinate systems"

#

What is the practical significance of this? Is it just saying that if we choose to work in the eigenvector basis that the effect of the transformation is the simplest?
essentially.

wintry glen
#

Hm, interesting. I don't fully get it yet, but I'll let it sit for a bit.

#

Thanks for the info regardless!

gilded furnace
#

isn't linear algebra about things like slope-intercept form and whatever

dusky epoch
#

no it isn't

gilded furnace
#

why does everyone make it seem so hard

#

then what

limber sierra
#

read the pins

dusky epoch
#

^

gilded furnace
#

wut

#

so hard

limber sierra
#

there are various numerical reasons why decomposing matrices is useful

#

and this result (at least over ā„ or ā„‚) eventually generalizes into the spectral theorem

wintry glen
#

Ah.

limber sierra
#

it's just one of many canonical ways to factorize a matrix

#

but if you happen to know the eigenvectors, or can easily compute them, it's a very convenient one

#

(and also the simplest)

wintry glen
#

Interesting how there's so many different factorizations with their own uses, like LU, PDP^-1, QR and SVD.

limber sierra
#

SVD is kind of like an eigendecomposition in that the principle is still trying to find "directions" (ie eigenvector coordinate systems) where the matrix "acts as a scalar"

wintry glen
#

I haven't learnt SVD yet. Maybe I'll understand when I get there.

limber sierra
#

on a more elementary level, this fact just gives you another way to think about diagonalizability

wintry glen
#

OK, I kinda get the ideas now. Thanks a bunch. The state of simultaneously understanding and not understanding is weird.

limber sierra
#

diagonalizability means that there exists an eigenbasis such that the matrix in that eigenbasis is diagonal

#

in other words, there exists a "coordinate system" that makes the matrix act "scalar" within that coordinate system

#

this isnt the most useful intuition like, computationally

#

but hopefully it makes "diagonalizable" seem a bit less... obscure

limber sierra
#

"it's possible to simplify this transformation's action if we change how we measure"

#

whereas nondiagonalizable matrices are just fucked

#

and dont permit a nice simplification

wintry glen
#

I just understood diagonalizability as something that allows us to compute high powers easily.

dusky epoch
#

"linear"? you mean like coordinatewise scaling maybe?

limber sierra
#

yeah sorry

#

scalar

wintry glen
limber sierra
#

essentially

#

you dont need to worry too much about the details here, it admittedly gets quite dense in definitions and computations

#

i find that that's when it takes longest for this stuff to set in

#

if it's just definitions i can parse that

#

if it's just computations i can see what the computations are doing

#

but eigenstuff and diagonalization involves both

#

so it takes a bit of practice to see the lines

#

you'll get the hang of it as you work at it

wintry glen
#

Yeah, I just wanted at least some understanding of why we bother with finding B-matrices of T and I've got that now, so I'm good. Thanks mate!

broken notch
#

I have a matrix u of size 3x12. The [x,y] values represent the coordinates of the lamps, [z] represents the height of the lamps. The equation for lightning each lamp, is lightning = x/d², where [d] is the distance from the lamp to the center of a matrix A of size 20x30. I want the lightning of each lamp to be as close to 1 as possible using the gram-Schmidt process and singular value decomposition. Does anyone have a clue? Please send help

zinc timber
#

wym by "distance from the lamp to the center of a matrix A of size 20x30"?

broken notch
#

or maybe someone can help me understand the question:

It is desired that the lighting level be as close as possible to 1.0 in all
squares. Use the least squares method to determine in python the brightness of each lamp using (i) š‘„š‘…-decomposition via enhanced Gram-Schmidt, respectively. (ii) SVD decomposition.

#

because I am having difficulties understanding what they want and how to do it

broken notch
zinc timber
#

how's this 20x30 then?

broken notch
# zinc timber how's this 20x30 then?

then for instance the center of that matrix is xc=10, yc=15, if I have a lamp with coordinates for instance [4,20],

and that lamp has a height of z=8

then I have a distnace from [4,20,8] to [10,15,0]

wintry steppe
gray dust
#

yes, just find a basis of the former space

lost temple
#

someone help me

coral flame
#

1.The distance between (2, -1) and (3,y) is 1. Find the value of y.

#

how do I do this one?

quartz compass
#

do you know of any formulas for how to find the distance between two points?

dusky epoch
#

this barely qualifies as linear algebra stareeyebrows

broken notch
#

can no one help me or throw me a bone happy_cry_cat

#

A parking space of 20m Ɨ 30m is illuminated via lamps placed in different places and at different heights, as indicated in Figure 1 page 3. The parking space is divided into a rectangular grid of 600 squares each of size 1m Ɨ 1m. The number š‘¦š‘— indicates the illumination level squared š‘—, for š‘— = 0,. . . , 599. Let š‘„š‘– indicates the strength of lamp š‘–. We select units so that the contribution to the lighting in square š‘— from lamp š‘– is š‘„š‘– / š‘‘2 š‘–š‘—, where š‘‘š‘–š‘— is the distance in ā„3 from the lamp to the center of square š‘—.

(a) State how the illumination level š‘¦ = (š‘¦0,..., š‘¦599) and the powers š‘„ = (š‘„0,..., š‘„11) are related via a linear equation system. Set the coefficient matrix for the system in python.

(b) Make a heatplot showing the illumination level in each square when all lamps are lit with intensity š‘„š‘– = 20.0.

(c) It is desired that the illumination level be as close as possible to 1.0 in all squares. Use the least squares method to determine in python the brightness of each lamp using (i) š‘„š‘…-decomposition via enhanced Gram-Schmidt, respectively. (ii) SVD decomposition.

#

I have done a and b

#

(I think)

#

but I dont know how to solve c)

#

this is the figure

#

can someone throw me a hint or help me understand what to do

lavish jewel
#

the part that takes effort is setting up the system of equations here

broken notch
#

I dont understand this "(c) It is desired that the illumination level be as close as possible to 1.0 in all squares. Use the least squares method to determine in python the brightness of each lamp using (i) š‘„š‘…-decomposition via enhanced Gram-Schmidt, respectively. (ii) SVD decomposition."

lavish jewel
#

so, basically what you want is to set up a cost function to minimize

#

you have an ideal "lighting", let's say, which is a vector with 600 entries that are all 1

#

on the other hand, you have the actual lighting, which is given by some f:R^number of lamps -> R^600

#

(assuming you keep the intensities x_i fixed)

broken notch
#

R^600 lamps?

#

huh

lavish jewel
#

no, 600 squares you want to illuminate

broken notch
#

I thought I only want to illuminate the lamps

#

from the lamp to the center

lavish jewel
#

oh yeah, that's a lot easier and sensible lol, i misread

#

there, fixed

#

so what you want is the sum of intensities at each square to equal 1

#

i.e. $J_m = \sum_{n=1}^{12} x_n/d_{nm}$

stoic pythonBOT
lavish jewel
#

this is the lighting at the mth square, where d_nm is the distance from each lamp to that square and x_n are the intensities of the lamps

#

i guess in your image you count from n=0 to n=11, but that makes no difference

#

what you have to consider is that the lamps are already placed and cannot be moved

#

this means 1/dnm is a constant

#

the variables are the x_n

#

with that in mind, you can notice that the sum can be rewritten as a dot product

broken notch
#

1/dnm varies from lamp to lamp

lavish jewel
#

let's say the distances from all lamps to the square m are put into a vector $\boldsymbol{d_m} \in \mathbb{R}^{12}$, and similarly, the unknown intensities are put into a vector $\boldsymbol{x} \in \mathbb{R}^{12}$

stoic pythonBOT
lavish jewel
#

you won't change them

#

each dnm is indeed unique, but also constant

#

now we notice that $J_m = \sum_{n=1}^{12} x_n/d_{nm} = \boldsymbol{d_m}^T \boldsymbol{x}$

stoic pythonBOT
lavish jewel
#

and we want $1 = \boldsymbol{d_m}^T \boldsymbol{x}$

stoic pythonBOT
lavish jewel
#

we notice we have exactly 600 of these equations, since there are 600 squares

#

we can set each d_m^T vector as a row in a matrix D. (btw in case it wasn't clear from the notation, the entries in each d_m vector are reciprocal distances, not just the distances)

#

this now gives us the matrix equation $\boldsymbol{1} = \boldsymbol{Dx}$, with $\boldsymbol{1} \in \mathbb{R}^{600}$ and $\boldsymbol{D}^{600 \times 12}$

stoic pythonBOT
lavish jewel
#

now you want to solve this exactly if possible, or approximate it if not

#

so your goal is to solve $\min_{\boldsymbol{x}} \Vert \boldsymbol{1} - \boldsymbol{Dx} \Vert_2^2$

dusky epoch
#

boldsymbolx

lavish jewel
#

yes.

stoic pythonBOT
lavish jewel
#

then we notice this is a linear least squares problem, which is convex (and strictly so if D has full column rank). this means you can take the gradient and set it to 0, then solve for x

#

that will give you a (possibly unique) global minimizer

#

if you have questions about this, it probably means you had parts a and b wrong

#

btw @broken notch if you could share screenshots of the original problem with me, i would appreciate it. seems like a cute problem to have my students practice their python

broken notch
lavish jewel
#

which language

broken notch
#

danish

lavish jewel
broken notch
#

I can translate it for you

#

if u want

lavish jewel
#

hmm nah, i think with the images and the description you already gave, it would be ok

broken notch
#

there are only two problems left

#

d and e

#

@lavish jewel 1.-Each row in D is a vector dm^T *x where dm= 1/dmn and x is the intensity vector, in our case is x=[0,1,2,3,4....11], right?

lavish jewel
#

each row in D is only a vector dm^T, without the x

#

we don't know what x is, and we solve for it

broken notch
#

2.-I don't understand how to solve min x||1-Dx||^2

#

how do I apply gram-Schmidt and sdv to solve the problem?

lavish jewel
#

well, from the other stuff i mentioned, you can take the gradient and set it to 0

#

the gradient would be D^T (1 - Dx)

#

or in other words, D^T 1 = D^T D x

#

and, for example if D^T D x is invertible, you get that x = (D^T D)^-1 D^T 1, which you should recognize as the solution to a least squares problem

#

(or well, even if not invertible, you can use the SVD method to get a projection onto the row space)

spare widget
#

In practice I use a CGNR or LSQR solver for this, but they are specifically asking for svd and QR here. Also the matrix seems to be dense.

#

To be physically correct they should use the squared distance too because of inverse square law but whatever.

#

Just fyi:

#

$\min_x |Dx - b| \implies D^TD x = D^T b$

stoic pythonBOT
#

criver

spare widget
#

The equations D^TDx = D^Tb are called the normal equations

broken notch
#

how can i use x to apply the svd and the gram-schmidt?

lavish jewel
#

you don't use x

#

you solve for x

spare widget
#

you can google normal equations and you'll get a lot of info

#

You need do apply QR and SVD to the system matrix D^TD

#

The right-hand side is y = D^T 1

#

Having the svd you can compute (D^TD)^{-1}

#

Similarly having QR you can solve

#

QRx = y -> Rx = Q^T y

#

The Rx part is solved as you do triangular matrices (it's sequential)

broken notch
#

y = D^T 1 what is 1 here

lavish jewel
#

a vector with 600 1s

#

is this homework or did you just look it up?

#

i think you're missing a few things before you're able to solve it

broken notch
#

homework

lavish jewel
#

have you seen least squares in class?

broken notch
#

a little

#

I will read up on it again

#

it should be like this q,s,vt = svd(D^TD), right then we use (q)^-1 D^T =x, right?

#

@lavish jewel

#

it is the same with q,r = qr(D^TD), the we use (q)^-1 D^T =x, right?

lavish jewel
#

i don't think that's right

spare widget
#

For svd you should get U, S, V such that D^TD = U S V^T

#

Then (D^TD)^{-1} = V S^{-1} U^T

#

then x = (D^TD)^{-1} D^T 1

#

For QR I already explained what you should do

lavish jewel
#

you'll have to check how python returns the S matrix. i seem to recall that, by default, it provides a full SVD and S is a vector

#

i.e. it might contain zeros you need to remove, and then turn it into a matrix

#

and possibly truncate the columns of U and rows of V^T

spare widget
#

well, he'll keep the zeroes

#

He'll just take the reciproc of the nonzeroes

lavish jewel
#

that's more annoying to do than truncating

spare widget
#

He'll get zeroes if this is a rank-deficient D

#

i.e. if there is no unique solution

#

then the reciproc gives the pseudo-inverse

lavish jewel
#

i'm just saying that doing it this way requires you to iterate over the elements of S

#

whereas truncating is done by reference and without iteration

#

it's better practice for larger problems

spare widget
#

idk what by reference and without iter means

lavish jewel
#

exactly

#

the code is bad and slow

spare widget
#

I doubt

#

Both do the same thing

lavish jewel
#

nope

#

they give the same result

#

the computer does them differently though

spare widget
#

If it's slow it would be because one coded it slow

lavish jewel
#

that's exactly what i am telling you

spare widget
#

if you mean that you do some redundant ops because of 0s, sure, but that's definitely not the bottleneck in an svd

lavish jewel
#

no, but it's certainly a problem

#

this doesn't scale well

spare widget
#

depends on the problem

lavish jewel
#

you're adding an O(n) problem on top of the O(n^3) one

#

the behavior is surely dominated by that of the O(n^3) SVD and matrix multiplications, but the delay is there

spare widget
#

for instance I work with problems where some redundancy is better since it allows more efficient parallelization, but that's way out of scope for the current question

lavish jewel
#

yeah that doesn't make a difference here

spare widget
#

tbf, I think the person asking has an issue even with the simpler case

lavish jewel
#

sure, they need a way to find the inverse in the first place, given the output of the svd function

spare widget
#

And I would never use svd in practice for the above problem

#

CGNR/LSQR or Cholesky rather

lavish jewel
#

that's fine, but they are explicitly asked to use it

spare widget
#

Yeah, I meant wrt the perf comment

wintry steppe
#

Let $A$ be a bijective linear transformation from $V$ to $W$ and span $(a_1, a_2, \dots a_n) \leq V$. Why $dim A $span $(a_1, a_2, \dots a_n) = dim$ span $(A(a_1), A(a_2) \dots A(a_3))$?

#

sorry have no idea how to format this correctly.

stoic pythonBOT
wintry steppe
#

because A(span(...)) = span(A(...))

#

or are you asking why dim span (...) = dim span (A(...))

spare widget
#

because the map is bijective

#

Let (v1,...,vm) be a basis for span(a1,...,an)

#

by the definition of basis these vectors will be linearly indepedent

#

which means that sum_i b_i v_i = 0 only for (b1,...,bm) = (0,...,0)

#

now assume that A(v1), ..., A(vm) were linearly dependent

#

then there would exist (b1,...,bm) such that sum_i bi A(vi) = A(sum_i bi vi)

#

but if A is bijective, then it is injective, and then A has a trivial kernel

#

so you get a contradiction and it follows that dim(span(v1,...,vm)) = dim(span(A(v1),...,A(vm))

wintry steppe
#

thank you. i dont understand how did you get a contradiction, could you repeat please?

#

im lost after "then there would"

#

but i do understand why A injective iff A has a trivial kernel

#

there'd be a contradiction because at least one of the b_i's should be non-zero

#

and that sum should be equal to zero

#

that's where you get to use injectivity

dusky epoch
sonic gulch
#

Does a linear transformation T : V→W transforms V's basis to a W's basis ? Or there are any extra conditions ?

wintry steppe
#

not necessarily, take the zero transformation

#

a necessary and sufficient condition is that T be an isomorphism

sonic gulch
#

Oh

#

If Ker T = {0}, does it imply then ?

distant schooner
stoic pythonBOT
distant schooner
#

i think this is the more "intuitive" version

sonic gulch
wintry steppe
#

bijective linear transformation

sonic gulch
#

Oh okay

#

Thank you

distant schooner
#

what is with the little leaf next to your name @wintry steppe ?

wintry steppe
#

it means i'm new

#

(i left for a month and came back)

distant schooner
#

right, but havent u been here for quite a while

#

oh i see

zinc timber
#

what leaf

void path
#

this is a nonogram, its a puzzle in which the numbers on each line represent how many blocks of continuous shaded pixels exist. There must be a white in between every blue "segment". When i go about solving them. Normally i solve them by thinking "hmm, 6 will need its middle 4 blocks colored no matter what so ill do that, then according to this column, that has to be a 1 so it should be white above and below" and so on...

But this feels like linear dependence and something to do with linear algebra, i just cant quite figure out how to apply it to solving these

#

this is a binary matrix, and im trying to figure out how to solve it mathmatically

#

my reasoning for wanting to figure this out, is that im building an operating system and this may be a better way of storing black and white photos

spare widget
#

Which gives you an equation for the stationary points

spare widget
#

I would instead suggest to use a readily available codec fir black and white images

distant schooner
#

i mean the projection is equivalent as well right?

#

ill try to show this

spare widget
#

That's how you derive it

spare widget
#

afaik you define the projection either through the x minimizing the L2 or as the x such that the error is orthogonal

#

the latter is typically called Galerkin formulation/condition

subtle gust
#

Can anyone explain linear subspaces to me?....

#

Specifically how you can prove that a given set is a subset of R^n

#

There's 3 ways and i only understand the first one

#
  1. using the def of a subset (that i understand)
  2. smthng related to homogeneous linear systems
  3. smthng related to the span of smthng
patent belfry
#

For 3, the span of any subset of vectors in $\mathbb{R}^n$ is automatically a subspace of $\mathbb{R}^n$

stoic pythonBOT
#

makatk

wintry steppe
# subtle gust 1) using the def of a subset (that i understand) 2) smthng related to homogeneou...

I'm assuming by "subset" you mean "subspace"? These are different terms though so you shouldn't conflate the two. Here's what I think you mean by your "three ways". These are three equivalent definitions.

  1. A subspace (of the vector space $R^n$ ) is a subset of $R^n$ which is closed under linear combinations (if $v_1, \dots , v_k$ are in the subspace, then $a_1 v_1 + \dotsm + a_n v_n$ is in the subspace, where the ai's are real numbers (scalars) ).

  2. A subspace is a set of solutions to a system of linear equations: ${x=(x^1,\dots,x^n) \in R^n ~,~ f_1(x) = 0,~ \dots,~ f_k(x)=0 }$, where the $f_i$'s are linear functions $R^n \to R$, i.e. of the form $f_i(x) = a_{i1}x^1 + \dotsm + a_{in}x^n$. The above set will specify a subspace of dimension $n-k$.

  3. A subspace is the "span" of a collection of vectors, where span means take the set of all linear combinations. This is nearly the same as my first definition.

stoic pythonBOT
trim bear
#

Going through my lin alg textbook and I wanted to show a cool proof I did

#

The first paragraph is the question

stoic pythonBOT
#

Wyatt The Baguette

round granite
#

iirc the intuition was "S is an isometry so S* = S^-1 so its just a change of basis"

last mist
#

not sure if this is exactly "linear" algebra, but would anyone know a way to solve the following problem without brute force?

ā”Œ       ┐     ā”Œ ┐
│1 1 1 0│     │1│
│0 1 1 1│ x = │2│
ā””       ā”˜     ā”” ā”˜
where x_i ∈ {0, 1}
``` alternatively, if there is a better channel to post this in, please redirect me
tacit pelican
#

could anyone help me fix up this proof?

#

i'm pretty sure the first two paragraphs are correct (i hope)

#

but

#

idk how to prove that if dim V = dim W, V=W

#

i feel like something needs to be added in that space i have put

#

but idk what

#

maybe my approach itself was incorrect

#

ill look through mse to see if i can find anything

native rampart
#

Think of that as solving
x_1(1,0) + x_2(1,1) + x_3 (1,1) + x_4 (0,1) =(1,2)

#

You need the first co ordinate to be 1 so only one of x_1 ,x_2 or x_3 should be 1

#

You need the 2nd co ordinate to be 2 so exactly 2 out of x_2 ,x_3 or x_4 has to be 1

#

If you choose x_1 to be 1 you find you don't have a solution

last mist
restive raft
# tacit pelican i feel like something needs to be added in that space i have put

This is how I'd prove this: assume $V \neq W$ then $\exists w \in W$ and $ w \not\in V $ then say ${v_1,...,v_n}$ is a basis for $V$ then we also have that ${v_1,...,v_n,w}$ is linearly independent, else $w$ is in $V$, but we have an inequality given a linearly independent set of vectors in a vector space $W$ that is is less than or equal,
$|{v_1,...,v_n,w}| \leq dim(W)$ but if $dim(W) = dim(V) = n$ we would have $n+1 \leq n$ which is not possible, hence there can be no such $w$ and hence they must be equal.

oblique prairie
#

would distinct here mean that each eigenvalue of A has multiplicity 1?

stoic pythonBOT
#

holazach

restive raft
stoic pythonBOT
#

holazach

oblique prairie
#

oh ok thanks, just making sure

restive raft
#

no problemo

lavish jewel
#

aren't those two things the same? hyperthonk

restive raft
#

huh

lavish jewel
#

the algebraic multiplicity is the power k so that (lambda - lambda_i)^k divides the char poly

#

if all of the eigenvalues are different, they have multiplicity 1

restive raft
#

I interpret statements like that as say the characteristic polynomial is $(\lambda - \lambda_1)^2(\lambda - \lambda_2)$ then the distinct eigenvalues are $\lambda_1, \lambda_2$ whereas you might say the eigenvalues are $\lambda_1, \lambda_1, \lambda_2$, if you have a n-dimensional operator with n distinct eigenvalues then it does follow each eigenvalue has multiplicity 1, but lacking that you can't say.

tacit pelican
#

this is fine right?

#

its basically what you wrote

stoic pythonBOT
#

holazach

restive raft
tacit pelican
#

thank you!

#

that proof took wayyy too long to do

lavish jewel
#

ah i reread what quantum posted, you're right. it doesn't say they all are distinct. that was my bad for skimming

native rampart
#

Instead of 2^(4) we are checking 4-1 cases

#

Actually here's a much better approach

#

x_1+x_2+x_3=1
x_2+x_3+x_4=2

x_4-x_1=1
implies x_1=0 and x_4=1 implies x_2 or x_3 has to be 1

last mist
#

true

#

@native rampart
is there a common algorithm this follows? or are you going mostly off of just manipulating the equations directly?

native rampart
#

Just manipulating

#

Maybe relevant

oblique prairie
#

could someone help me start the proof stated in the last line? i’m clueless on how to start it

native rampart
#

What is $x_1',x_2'...$

stoic pythonBOT
#

BYE BYE!

native rampart
#

@oblique prairie

#

nvm derivatives

#

Prove x(t) is of that form first

#

Then try multiplying both sides
of
$\sum_{i=1}^k e^{\lambda_i t} z_i = 0$( Proving { $e^{\lambda_i t} z_i | i \in {1,2,3...k} $ } will work I think)
with $(A-\lambda_2)(A-\lambda_3)...(A-\lambda_k)$
This would cancel all the terms except $e^{\lambda_1 t} z_1$

#

The correct approach would be something along those lines

stoic pythonBOT
#

BYE BYE!

restive raft
# oblique prairie could someone help me start the proof stated in the last line? i’m clueless on h...

We want to prove a two way implication first start with if $x(t) = \sum_{n=1}^{k} e^{\lambda_it}z_i$ then
$x'(t) = \sum_{n=1}^{k} \lambda_i e^{\lambda_it}z_i$
and since $Az_i = \lambda_i z_i$ we have $x'(t) = Ax(t)$.
then going the other way given $A$ is diagonalizable the direct sum of each eigenspace, $E_{\lambda_1} + E_{\lambda_2} + ... + E_{\lambda_k} = V$ is the space so each vector $x(t)$ for every $t$ can be written as a linear combination of $z_i \in E_{\lambda_i}$ so $x(t) = \sum_{n=1}^{k}c_i(t)z_i$ then if we have $x'(t) = Ax(t)$ then
$\sum_{n=1}^{k}c_i'(t)z_i = \sum_{n=1}^{k}c_i(t)\lambda_i z_i$ given that this linear combination is unique it is a requirement that we have $c_i'(t) = \lambda_i c(t)$ which leads to a solution $c_i(t) =b_i e^{\lambda_i t}$ for some scalar $b_i$ but we can just transform $z_i -> b_i z_i$ and then the result follows

stoic pythonBOT
#

holazach

oblique prairie
#

well, i already proved that those statements are equivalent

#

i was talking about the line at the bottom of the screenshot

#

oh wait

vernal slate
#

Hi how are you all doing, I'm just into linear algebra, I'm having confusion finding NPC (non pivot column)
For example,
[ 1 4 0 4 0]
[0 0 1 0 0]
There are no NPC's right?

restive raft
#

there are non pivot columns, columns 1 and 3 are pivot columns so 2 and 4 and 5 will be non pivot columns

vernal slate
#

Thanks man

restive raft
#

np

broken notch
#

Least squares via QR (š“, š‘)
Requirements: the columns of š“ are linearly independent
1 Calculate a thin š‘„š‘… decomposition š“ = š‘„š‘…
2 Calculate š‘„š‘‡ š‘
3 Solve š‘…š‘„ = š‘„š‘‡ š‘ via back substitution
what do they mean by thin

lavish jewel
#

this is what wikipedia shows

zinc timber
#

if $P \geq 0$ (entrywise) and $\rho(P) < s$ then $sI - P$ is non-singular M matrix (this part is easy to see) but how do I show that if $\rho(P) = s$ then $sI-P$ is singular (M matrix)

stoic pythonBOT
zinc timber
#

looks similar to stochastic matrix that if spectral radius is s then s is an eigen value

#

could find some help from there

lavish jewel
#

that's the one i had in mind when i suggested looking at stochastic matrices

#

but all i know is that it exists šŸ˜›

languid sphinx
#

P-F is a powerful theorem

#

IIRC the proof is not hard-hard, but tedious

zinc timber
#

I only need the statement for now

zinc timber
#

to show that if H is non-singular M-matrix and B and BH^-1 both are Z-matrix then BH^-1 is non-singular M matrix <=> BH^-1 is non-singular M matrix

#

though again I only needed the statement

broken notch
#

@lavish jewel
im still stuck on this problem from yesterday perhaps you can tell me if I am correct?

import numpy.linalg as la
import matplotlib.pyplot as plt
import numpy as np

#Define the coordinate of the lamps
x=np.array([  4,  3, 19, 16,   9,   5,  18,   16, 12, 12,    2, 13])
y=np.array([ 20,  2,  4, 16,  28,  11,  13,   25, 12, 23,   15, 4])
z=np.array([2.8,  3,  3,  3, 3.4, 3.5, 3.6,  3.8,  4,  4,  4.5, 3.6])


#We define the center of the of the square, e.g. matrix A
xc=15
yc=10
zc=0

#We compute the distance from the center [xc,yc,zc] to [x,y,z] coordinates of each lamp
xxc = x-xc
yyc = y-yc
zzc = z-zc

#The ligthning square from each lamp is calculated by dividing the intensities xi 
# with the square of the distance in R³ to each lamp from the center.

xi=np.array([0.001, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])

#Vector that contain the reciprocal distance from the lamps to the center.
dm = xi/(xxc**2 + yyc**2 + zzc**2)


b=np.ones(shape=(12,1))

#Create and populate matrix D of size 12x12 with the vector dm 
D = np.zeros((12,12))
for i in range(12):
    for j in range(12):
        D[i][j]=dm[j]
    
    
#Now we need to solve 1-D * x with:
# Least squares via SVD (D, š‘) 
# 1 Calculate a reduced SVD D = š‘ˆĪ£š‘‰ š‘‡
# 2 Calculate š‘ˆ š‘‡ š‘
# 3 Solve Ī£š‘¦ = š‘ˆ š‘‡ š‘
# 4 Set š‘„ = š‘‰š‘¦

u, s, vt = np.linalg.svd(D)

s= np.diag(s) @ np.diag(1/s)

utb = np.matmul(u.T,b)
sinv= la.inv(s)
y = np.matmul(sinv,utb)
x = np.matmul(vt.T,y)
Asvd=np.matmul(D[0],x)  
print(np.sum(Asvd))
meager harness
#

how to do 4b

native rampart
#

What have you tried

#

The solution is the minimal polynomial has to be either x or x^2(why)

#

In the former case,A is just 0 matrix

#

In the later case, pick any x such that Ax!=0

#

And x,Ax form a basis

#

Writing A in that basis gives you the answer

meager harness
wintry steppe
#

Let k* be a linear form from the space of polynomials of degree less than 3 to R such that k* (q) = q(0). If B is a basis for that vector space, how to find B*?

lavish jewel
#

try writing a polynomial of the prescribed order and see what happens when you evaluate at 0

#

in particular, what happens to terms that have the variable present in them?

wintry steppe
#

they disappear

#

hm

#

if B = {b1, b2, b3} then we can write

q = Ab1 + Bb2 + Cb3

and i would expect that k* (b1) returns A, k* (b2) returns B, k* (b3) returns C

#

is that correct?

lavish jewel
#

i would expect k*(b_i) to be either 0 or the coefficient c_i

#

depending on what b_i is

#

can you show what exactly the problem statement is btw?

wintry steppe
#

so

k* : P2 --> R
k* (q) = q(0)
i need to write k* as a linear combination of vectors in B*. and B = {1, 2-x, 2-x^2}

lavish jewel
#

there we go, that makes it a lot easier that doing it in general

#

to give a hint

#

since it's a linear form, what rank does the linear transformation have?

#

what shape should the corresponding matrix have?

wintry steppe
#

i think rank = 1 because k* is not 0?

lavish jewel
#

yeah

#

and your matrix would be of size 1 x 3, just a row vector

#

what i would do is to split the problem up into easier problems

#

if the basis were nice and simple like the canonical basis {1,x,x^2}, then k* would be a lot easier to describe, right?

#

so we could do that first

#

and then, write a change of basis matrix that takes vectors in the B basis and maps them to the canonical basis

#

then the overall transformation is the composition of these two, i.e. apply k* to the vectors that have been transformed from the B basis to the canonical one

dark pier
#

If V = {x + y | x ∈ span{u}and y ∈ span{v}}, where u and v are two fixed
non-zero vectors in R3, then V is a subspace.

#

can someone help guide me on how to show if this is True or False?

wintry steppe
lavish jewel
#

that's precisely what the change for basis from B to the canonical one is šŸ™‚

wintry steppe
#

i got

$a_{2}x^2 + a_{1}x + a_{0} = (a_{0} + 2a_{1} + 2a_{2}) + (-a_{1})(2-x) + (-a_{2})(2-x^2)$

is my matrix
$\begin{pmatrix} a_{0} + 2a_{1} + 2a_{2} \-a_{1} \ -a_{2} \end{pmatrix}$?

stoic pythonBOT
humble oak
#

hello there, i'm a bit confused about this example

#

how exactly did they determine the number of free variables?

#

nevermind, they are x^2 and x right?

restive raft
#

you can solve one of the variables in terms of the others say $ax^2 + bx + (-a -b)$ then the free variables are $a,b$

stoic pythonBOT
#

holazach

humble oak
#

oh okay, thank you

distant schooner
#

is there a relationship between the geometric product and its reverse? such as $(AB)^\dag = B^\dag A^\dag$... im trying to prove or disprove this myself so any "hints" would be cool, if such a relationship exists (probably does)

stoic pythonBOT
quartz compass
#

well reverse(A) = (-1)^(grade(A)(grade(A)-1)/2) A so nothing super exciting using the fact scalar multiplication commutes

short canopy
#

so, i'm trying to understand this "the plane xy are all the points perpendicular to the Z axis. Therefore, we could say that they are the points (x,y,z) such that (x,y,z).(0,0,1) = 0, (0,0,1) being the normal to the plane "

#

i don't understand why (x,y,z).(0,0,1) = 0, isn't it (x,y,z).(0,0,1) = z ?

lone flume
short canopy
lone flume
#

Yes, that's the point

#

The xy-plane consists of all the points satisfying z = 0.

short canopy
#

so, im supposed to assume z = 0 or something like that? mniip

#

weird

lone flume
#

The point (x,y,z) lies on the xy-plane if and only if z = 0.

quartz compass
#

points without z=0 are the points that have floated off the xy plane

short canopy
#

right

broken notch
#

A parking space of 20m Ɨ 30m is illuminated via lamps placed in different places and at different heights, as indicated in Figure 1 page 3.
The car park is divided into a rectangular grid of 600 squares each of size 1m Ɨ 1m. The number š‘¦š‘— indicates the illumination level squared š‘—, for š‘— = 0,. . . , 599. Let š‘„š‘– indicate the power of lamp š‘–. We select units so that the contribution to the lighting in square š‘— from lamp š‘– is š‘„š‘– / š‘‘2š‘–š‘—, where š‘‘š‘–š‘— is the distance in ā„3 from the lamp to the center of square š‘—.

(a) State how the illumination level š‘¦ = (š‘¦0,..., š‘¦599) and the powers š‘„ = (š‘„0,..., š‘„11) are related via a linear equation system. Set the coefficient matrix for the system in python. (You must estimate the coordinates of the location of each lamp from the diagram.)

please can someone help me with problem a) I am having a real hard time understanding what to do

#

figure

restive raft
#

$M_{ji} = 1/d^2_{ij}$ should be 600x12 matrix and then the system is $Mx = y$

stoic pythonBOT
#

holazach

broken notch
restive raft
broken notch
restive raft
#

the d_ij has the distance in R^3, wouldn't that already be included?

broken notch
# restive raft the d_ij has the distance in R^3, wouldn't that already be included?
import numpy as np
import matplotlib.pyplot as plt


center_x = 12/2
center_y = 600/2

M = np.zeros((600,12))
for i in range(600):
    for j in range(12):
        if(i==center_x and j==center_y):
             M[i][j]=1
        else:
            M[i][j]=1/((i-center_x)**2 +(j-center_y)**2)


fig, ax = plt.subplots(figsize =(1, 100))
plt.imshow(M, cmap = "hot")
plt.colorbar()

ax.set_xlabel('X-axis') 
ax.set_ylabel('Y-axis') 

plt.tight_layout() 
plt.show()    

looks weird, is it something like this?

#

I populate the 600 by 12 matrix

broken notch
broken notch
#

I will have to know y and A right

sour flame
#

Okay this is probably a super simple question but for life of me I can't figure out why S is not a subspace of W

#

like, I don't understand why you can't just for example do (0,1) * 3 and get (0,3) which is also an element of R^2 is there something very big I'm missing? Because my lecturer brought this up as an example for why it's not closed under scalar multiplication (unless I misheard him?)

quasi vale
#

@sour flame For S to be a subspace, we need to make sure the following conditions are satisfied: For any v in S, cv is in S, c is a scalar and for any v,w in S, v + w is in S. If you multiply (0,1) by 3, you get (0,3) and (0,3) is not in S. You can also do (0,1) + (1,1) = (1,2) which is not in S.

languid sphinx
#

Way too many things are not in S, so I feel like you're not getting the intuition right

sour flame
#

oh wait okay for some reason I was thinking about all linear combinations of the things in S was a subspace of W rather than S itself

#

thanks for the clarification

#

šŸ™ I was staring at this for 15 minutes for no reason

dusky epoch
#

do not confuse a set with its span

broken notch
#

@lavish jewel
will this be correct reasoning?

spare widget
#

We already went over this

#

Let (M^TM) =USV^T

#

Then (M^TM)^{-1}= V S^{-1} U^T

#

So the solution is x = (M^TM)^{-1}M^T 1 = VS^{-1}U^TM^T 1

#

You get the normal equations M^TM x = M^T 1 by differentiating |Mx - 1|^2 wrt x and setting the derivative to be equal to zero (i.e. the equations for the stationary points)

broken notch
#

@spare widget When you say (M^TM) =USV^T is it the same as: usv^t = sdv(M^TM)

in the equation VS^{-1}U^TM^T 1 , what is 1?

x will be the size 600x12, so by multiplying M^T*x^T I get Mx of size 12x12 so I guess if I take one row it is the solution to x, right?

spare widget
#

Yes it's the svd. 1 is a column vector of 1s. Idk what your last question is about.

broken notch
wintry glen
#

Hey, sorry if this is a bit of a stupid question, but for (c), do I just let $\mathbf{x}_0 = (1, 0)$ and compute $\mathbf{x}_2 = P^2\mathbf{x}_0$?

stoic pythonBOT
#

PhenomPlasma

elfin agate
#

šŸ‘‹ i have a question regarding matrices corresponding to a map f:R^2–>R^3 . f is referring to two basis V={v,u} und W={x,y,z}

#

M(f)= ( 3 2, 1 0, 2 -1)

#

and the task is to transform M(f) so that it refers to the standard bases of R^2,3

#

to my actual question: i would like to find the map f from M(f) by having each column of M(f) as the solution of two equations

#

specifically: f(v)=f(2,7)= (3, 1, 2) and f(u)=f(1,4)=( 2,0,-1)

#

for the first column of f we had the system of equations like this:

#

2λ+7μ=3 and λ+4μ=2

#

leading to: λ=1 μ=-2

elfin agate
#

if i do this for every column i get f(a,b)=(a-2b, 4a-b, 15a-4b)

#

is this form f unique??

vale cape
#

what do you mean by 2-digit rounding in solving systems of equations?

For example, use Gauss-Jordan Elimination method and 2-digit rounding in solving systems of equation

elfin agate
#

ups, i meant row and not column xD maybe thats clear now

#

so basically M(f)=(f(v),f(u)) ,f(v)/f(u) being column vectors with the values that you can see in the text above and i want to get f

#

in the way as i referred in the text above, will the result will be the right one?

elfin agate
#

or i have the totally wrong approach the hole time D:

short canopy
#

say i have this implicit equation for a line y = 2x + 1, how do i make it into a vectorial equation? my first approach was saying something like (x, 2x+1) = (x,2x) + (0,1) = x(1,2) + (0,1) but this is wrong when i compare it to some exercise from a book i'm using

quartz compass
#

that's correct

#

there's more than one way to do it though

#

so maybe that's why you think it's wrong

#

show some examples of what they give as the answer

#

for instance another way entirely is write it as -2x+y=1 and then you can recognize the dot product (-2,1) dot (x,y)=1

elfin agate
#

a quick understanding question: if k is an element of ker(f) with f being a homomorphismn would g(k), g being also a homomorphismn also be in the kernel of f?

#

if k=0 surely but im not sure if that statement holds for any k

quartz compass
#

nope, imagine f projects on the x axis and g projects on the y axis

elfin agate
#

damn, i want to show g(f(k))=f(g(k))=0 is there a trick im missing? g(f(k))=0 follows quickly since f(k)=0 and g(0)=0 but im not confident baout f(g(k))

quartz compass
#

is that true?

#

I'm thinking f projects on the x axis and g rotates by 90 degrees, that'd be a counterexample

#

maybe I'm not paying enough attention to something here

elfin agate
#

hold on, i didnt read the task correctly, i have to show the existence of a g, element of Hom(V=R^n) such that the equality holds

quartz compass
#

identity 🤣

elfin agate
#

i mean yes

#

am i tarded?

#

ah hold on again, g is unequal to zero

#

i thought they mentioned it so that you have to guess that you have to play with the kernel of f

#

hmm

short canopy
# quartz compass that's correct

it's weird, i was doing some exercise where i did the same method and the result wasn't the same, i verified it with graphing software and it wasn't the same

little oriole
#

is the det(0) = 0?

#

couldnt find a calculator that would work to confirm

wintry steppe
#

yes

little oriole
#

awesome

wintry glen
trim bear
#

How would I properly denote the fact that two vectors make up the columns of a matrix?

#

Col(A) = vec1, vec2?

elfin agate
#

i would use A=(u,v) and specifacally mentioning that the vectors u,v are columns by showing the dimension

elfin agate
# quartz compass identity 🤣

a friend of mine shared his solution and i thought you might be interested, one can construct g such there are k_i =g(v_i) so that some of the k_i’s are the base of the kernel of f while others are in the image

icy blade
#

yo so kinda noob question

#

but after i find rref and find that the vectors are linear dependent

#

how can i find what combination of those vectors give zero vector

hoary void
#

Well you could solve the system of equations

#

Like say a1,a2,a3 are the vectors and b_n constants then: b_1a_1 + b_2a_2 + b_3a_3 = 0(vector) this would just make a 3x3 system that you could solve for b_n

icy blade
#

ok but i did solve them, now the problem is to actually get the b_ns

#

my final matrix is ([1 0 3 0] , [0 1 5 0] , [0 0 0 0]) where [] is a row

#

what do i do from here @hoary void

#

okay i got it nvm

wise nebula
#

this question is about a linear application

#

and asks for which a's the v vector is in the image of the application

#

but you shouldnt be supposed to multiply the matrix with the vector since its 4 columns 3 rows

#

i'm very confused about this and i have an exam tommorw

#

someone can help out?

#

(4 column matrix, 3 rows vector)

pliant ore
wise nebula
#

yea but

#

how can you do the row x column product

#

if the number of the columns of the first doesnt equal the number of the rows of the second?

pliant ore
#

you cant

#

unless you add a 0 to the vector or something

wise nebula
#

then that problem makes no sense

#

since the application its literally

#

Av

#

but i can't do that

wise nebula
#

because i think i am

pliant ore
#

well either the question is wrong or you're missing something

wise nebula
#

and that's for sure

#

but

#

you should notice

#

if i'm missing something

#

right?

#

idk this is just fucking my mind

#

the question shouldnt really be wrong

#

cause its a exam simulation for all class given days ago and nobody complained

#

its just so weird

#

they don't answer yet if youre wondering

wintry glen
broken notch
#
import numpy as np

x = np.array([-1, 1])[:, np.newaxis]
y = np.array([1, -1])[:, np.newaxis]
b = np.array([1, 1, 0])[:, np.newaxis]



A = np.array([[-1,0],[0,1],[1,-1]])




if ((A@(x+y)+b == A@x + A@y+b).all() and (A@(5*x)+b == 5*A@(x)+b).all()):
    print("It is linear")
#

is this correct?

#

I need to check if it is linear

dusky epoch
#

are you forced to check it for linearity with a program and forbidden from doing so by hand?

broken notch
#

but it is numerical linear algebra

#

that is why I am using python

#

bcs the exam will be in pytohn

dusky epoch
#

there's no need to use any programming here

#

L as written here is obviously not linear: L(0) is not 0!

#

and you don't need a computer to tell you that, surely.

broken notch
#

I need to check
#Check A(x+y) = Ax + Ay
#Check A(sx) = sAx

#

right?

dusky epoch
#

that's the definition of linearity yes

#

but you should know a thing or two about linear maps

#

such as: any linear map sends zero to zero

broken notch
#

hmm

dusky epoch
#

so a map that sends zero to something other than zero cannot be linear no matter what

broken notch
#

it is returning true

#

tho

#

im confused

dusky epoch
#

what is [:, np.newaxis]?

broken notch
#

just prints horizontally

#

I think

dusky epoch
#

...

#

you think?

#

so you are using things whose function you yourself are not fully aware of.

broken notch
#

I mean

dusky epoch
#

why, then, are you confused that you are getting bullshit results?

broken notch
#

new axis creates a new col

#

so instead of (3,)

dusky epoch
#

garbage goes in, garbage comes out.

broken notch
#

it is (3,1)

dusky epoch
#

also it looks like your calculation is bad anyway

broken notch
#

yea I thought so

#

bcs everything returns linear šŸ˜„

dusky epoch
#

you have L(x) = Ax + b, sure
and then L(x+y) = A(x+y)+b, but L(x)+L(y) = (Ax+b)+(Ay+b) not Ax+Ay+b as you wrote!

#

and once again!

#

this stuff shouldn't require a computer!

#

a computer can't prove linearity like that anyway!

#

the best you can do is demonstrate some examples of linearity being satisfied for some particular inputs!

#

do not rely on computers for that which can and should be done by hand!

broken notch
#

I need to use python

#

the entire course is numerical linear algebra in python

dusky epoch
#

what do you mean, "need"?

#

has your teacher said explicitly that EVERY SINGLE EXERCISE HAS TO be done in python and any non-python solution will be REJECTED OUT OF HAND?

#

even these?

broken notch
#

ok now it works

#

the teacher wont see this

#

these are just exercises

#

but I like to practice

#

in python bcs the exam is in python

dusky epoch
#

so why use python for things that don't require it...

#

you're not answering my question either

broken notch
#

"the exam is in python"

dusky epoch
broken notch
#

I can do it in hand

#

np

#

but the exam is in python

dusky epoch
#

who gives a shit.

#

it sounds like you are just learning the very basics of linear algebra, and the 'numerical' part has not yet really come up.

if you're at the level where you're trying to verify whether or not a map is linear, you're not doing any numerics.

broken notch
#

I do

dusky epoch
#

it sounds like you are just learning the very basics of linear algebra, and the 'numerical' part has not yet really come up.

if you're at the level where you're trying to verify whether or not a map is linear, you're not doing any numerics.

#

you are NOT yet doing any numerics. you aren't trying to get any approximate solutions. you're not doing things like finding eigenshit numerically.

broken notch
#

I did the first one

#

by hand

#

and said cba

#

I dont see a reason to do it by hand if I know how to do it by hand

dusky epoch
#

this exercise can be done in one line

#

L(0) != 0

#

that's it

#

no need for any python shit.

#

it's going to take 10 times more effort to write a python program than to just do some observations yourself.

broken notch
#

yea but i am not well versed I dont see what you see

#

I just follow the formula

dusky epoch
#

and a program really will not help you with that at all.

#

i think trying to do everything programmatically will really muddle your vision even further.

#

ignore this advice at your peril, i suppose.

quartz compass
broken notch
#

so what should I do :D?

#

not do the exercises or what I dont get it

dusky epoch
#

do things by hand unless there's good reason to do it programmatically.

lavish jewel
#

to do the logic on paper, and then code the logic afterwards

#

good code starts on paper

dusky epoch
#

if you need two dense 10x10 matrices multiplied fsr, obviously nobody is forcing you to do it manually. that's what computers are for. they're glorified calculators.

broken notch
#

doing it on paper would take way longer

#

and I dont have that kind of time

#

I also have other exercises and homework

dusky epoch
#

do you want to write shit code?

#

if you want to pump out thousands of lines of shit code you don't need any paper

#

but shit code, unsurprisingly, is shit.

lavish jewel
#

the logic, not the matrix multiplication

dusky epoch
#

if you are doing something that actually takes many computations like an iterative method of some kind, that's something for computers to do - but yeah, as edd said, first write out the formulas on paper.

broken notch
#

yea I know I usually do that

dusky epoch
#

well then do that

broken notch
#

but you dont need that to check if it is linear

dusky epoch
#

you do, as evidenced by you writing the linearity conditions incorrectly in your example.

broken notch
#

more of a typo

#

my question was about if it was correct to say Ax + b

#

bcs in the slides of my teacher he doesnt write Ax+b in his examples

dusky epoch
#

this only comes up now thonk

#

your map is representable in that form, yes.

broken notch
#

I probably formulated the question badly KEK

dusky epoch
#

yes you did.

hard drum
#

Anyway hello

hushed hedge
#

it keeps brining up calculus on the browser lol

hard drum
#

Lol dw

hushed hedge
#

for example let's say i have the point X = (-1,-2,0) in the plane of pi: x-y+z=0 and i want to solve for the orthogonal projection

#

so this was the problem

hard drum
#

Sure