Hacker News new | past | comments | ask | show | jobs | submit login
The tensor product, demystified (2018) (math3ma.com)
94 points by RevoGen on Sept 2, 2023 | hide | past | favorite | 31 comments



Hmm, I always disliked coordinate approach to (multi)linear algebra. To me, the notion of a tensor product clicked with the following definition:

Tensor product v₁⊗v₂ of vectors form V is bilinear form on the dual space V* defined by v₁⊗v₂(ω₁,ω₂) = v₁(ω₁)v₂(ω₂). Tensor product V⊗V is space of all bilinear forms on V*,

This can easily be generalized to products of forms (covariant tensors), and mixed tensor products. Getting coordinate representation in basis (E₁ ... Eₙ) is trivial: (v₁⊗v₂)ₖ,ₗ = v₁⊗v₂(εₖ,εₗ) where εₖ is dual to Eₖ...


> Tensor product V⊗V is space of all bilinear forms on V*

This is only true for finite-dimensional V. In general bilinear forms on V* are linear maps `V*⊗V* -> F` (where F is the base field) which is isomorphic to `(V*⊗V*)*`. For infinite-dimensional V this is much larger than `V⊗V`.

The general characterization is that `V⊗W` is the vector space (and associated linear map `⊗: V x W -> V⊗W`) such that for every bilinear map `h: V x W -> T` there's a unique linear g such that `h(v,w) = g(v⊗w)`. Intuitively, it adds "just enough" elements to `V x W` to encode arbitrary bilinear maps as linear ones.


I always dislike the unnecessary use of dual of dual. We should define tensor product as a quotient space of all linear combinations of v₁⊗v₂ as in https://en.wikipedia.org/wiki/Tensor_product#As_a_quotient_s... The advantage of not using dual of dual is that it generalizes correctly to infinite dimensional vector spaces and modules.


It was a bit annoying that the first few examples give a flattened tensor product. It's explained at the end, but the dimensions are at least as important as the values and it feels wrong to skip that (isomorphism notwithstanding).


Some additional ressources on tensors I've found useful:

1) A video[0] by Michael Penn exposing this idea of "tensor product of vector spaces." It's close to what is presented in this blog post, but more rigorous/complete.

2) Two videos[1][2] by Frederic Schuller. They are each from of bigger courses (resp. ~Differential Geometry for Physics and Quantum Mechanics), but I think they are self-contained enough to be intelligible. They both present tensors in different settings, so one will have to work a little to unify all this. I like in particular how in [1] he really takes the time to first distinguish between all the different tensor product (of space, of vectors, of operators): the usual notation/terminology can be needlessly confusing for beginners.

[0]: https://www.youtube.com/watch?v=K7f2pCQ3p3U

[1]: https://www.youtube.com/watch?v=OZ1WCyJmjgo

[2]: https://www.youtube.com/watch?v=4l-qzZOZt50


> But why the tensor product? Why is it that this construction—out of all things—describes the interactions within a quantum system so well, so naturally? I don’t know the answer

That's an odd thing for the author to say, because s/he gives the answer later in the very same passage:

> but perhaps the appropriateness of tensor products shouldn't be too surprising. The tensor product itself captures all ways that basic things can "interact" with each other!

That is the answer. It's the tensor product because there are logically no other possibilities. The tensor product says everything you can possibly say about the interactions of two systems whose states are described by a (possibly infinite) set of numbers and whose interactions correspond to some basic constraints, like being time-reversible. It just so happens that nature behaves according to those constraints, and that is why the tensor product describes the behavior of nature.


> It's the tensor product because there are logically no other possibilities.

There are many other possibilities, unless you can provide satisfactory answers (from first principles) to the following questions: Why would we expect superpositions of quantum states to be encoded as a vector sum of the individual state vectors? Why is time evolution in quantum mechanics a linear operation on those state vectors?

If those things weren't true, tensor products would be utterly useless to describe product states.


> Why would we expect superpositions of quantum states to be encoded as a vector sum of the individual state vectors?

Because that's what the word superposition means. If you don't have linear dynamics you don't have superpositions that aren't sums of other states, you just don't have superpositions.

> Why is time evolution in quantum mechanics a linear operation on those state vectors?

This, on the other hand, is an open physical question. An answer to "Why QM and not some completely different theory" is probably not in the cards, but as long as we're only considering "nearby" theories, nonlinearity gets you either superluminimal communication (bad) or basis-dependent observables (worse) depending on which bullets you bite.


> > Why would we expect superpositions of quantum states to be encoded as a vector sum of the individual state vectors?

> Because that's what the word superposition means.

No, that's not what superposition means a priori. I can think of many other ways to implement (mathematically) the idea of a system being in "two states at the same time", apart from vector addition. Yes, if you do Stern-Gerlach often enough, you might convince yourself that the vector space structure is a sensible choice but I take issue with OP's statement that

> there are logically no other possibilities

as if things had been obvious right from the get-go.


> No, that's not what superposition means a priori.

The word was originally used to describe the decomposition of waveforms into sums of sinusoids, which is as canonical an example of a linear system as you can get.

> the idea of a system being in "two states at the same time", apart from vector addition.

But that's not what's going on. A system is only ever in one state at a time: the ability to treat it as a sum (modulo the norm) of other states is linearity of all operators. This has immediate observable consequences: nonlinear operators can distinguish between different ensembles realizing the same mixed state.


> > No, that's not what superposition means a priori.

> The word was originally used to describe the decomposition of waveforms into sums of sinusoids, which is as canonical an example of a linear system as you can get.

You are right, I was being a bit too sloppy with my usage of the term "superposition". I guess once people realized that a QM system being in "two states at the same time" is just a linear sum like for waves, they started calling it a superposition. Anyway, my point (in my original comment) was a completely different one: You still have to assume all that linear structure to start talking about how canonical the tensor product is.

> But that's not what's going on. A system is only ever in one state at a time: the ability to treat it as a sum (modulo the norm) of other states is linearity of all operators

Again, you are right, that's why I put it in quotes. Nevertheless, if we start just from the observation that a system can occupy two states "simultaneously" (in the sense that sometimes we measure one, sometimes the other state) we might think of other ways to encode that beyond vector sums, e.g. Cartesian products without any linear structure.

Anyway, I don't think we disagree fundamentally, we're merely arguing about terminology.


A useful illustration: polarized light can be considered to be in a superposition if you use a basis rotated 45 degrees to the polarization axis. So whether or not polarized light is in a superposition depends entirely on how you choose to look at it. It's not a reflection of the underlying physical reality.


I think we're talking past each other. :) I fully agree with your comment. However, I was addressing your original comment[0] about the naturalness of the tensor product. My whole point was merely (and maybe I didn't phrase it particularly well) that you need to assume all the stuff we (now) know about quantum mechanics (vector space structure etc.) in order to conclude that the tensor product is pretty much the only option you have. Your comment didn't mention this and seemed to make a much broader claim. That was all.

(EDIT: I think your other comment[1] fully resolves any gripe I had with your original comment. :))

[0]: https://news.ycombinator.com/item?id=37363347

[1]: https://news.ycombinator.com/item?id=37372225


We don't expect these things, we merely observe them. Indeed, the fact that QM is linear and hence time-reversible is violently at odds with everyday experience, so it is emphatically not the case that we "expect" these things. This just turns out to be how they are. The tensor product is merely the most compact description of these observations, kind of like how untyped lambda calculus turns out to be a compact description of universal computation (which is also not a thing that one would a priori expect).


> We don't expect these things, we merely observe them.

Sure, but your original claim was that

> It's the tensor product because there are logically no other possibilities. The tensor product says everything you can possibly say about the interactions of two systems whose states are described by a (possibly infinite) set of numbers and whose interactions correspond to some basic constraints, like being time-reversible.

I merely wanted to point out that your claim sounded quite broad and you need to assume many things about the mathematical structure of QM here (based on established observations of course). So, unless you simply take those for granted, you would have to come up with an explanation for them in order for there to be

> logically no other possibilities

In this case, though (if you take all those observations for granted), your claim becomes almost tautological IMO.


It is a tautology. The heavy lifting is being done by the phrase "whose interactions correspond to some basic constraints". Maybe the word "basic" implies more simplicity than is warranted, though if you actually write down what the constraints are, it's a short list and they are not very complicated. That those constraints lead to the tensor product is tautological. I'm not saying this is a Deep Insight, only that it is the answer to "Why the tensor product?"

BTW, just because something is a tautology doesn't mean it can't lead to deep insights. Darwinian evolution is a tautology too: if you have a variety of self-reproducing systems, then the ones that are better at reproducing will make more copies than those that are worse. Well, duh! That's what "better at reproducing" means! The thing that makes it a Deep Insight is that this tautological observation can actually explain some very complex data. Likewise, that the tensor product is the mathematical construct that describes linear interactions between systems that obey conservation laws is a tautology. What makes that a Deep Insight is not that, but the fact that the resulting relatively simple math makes surprising predictions (entanglement in particular) that turn out to be confirmed by experiment.


So in short, tensor product is just saying “Everything may contribute to everything. Linearly.“


Yep, pretty much.


A nice, high school level writeup of how to calculate this product with ordinary vectors, but it totally drops the ball on the necessity and its use in physics. It would probably be best to ignore the entire last paragraph and instead read up on pure vs. mixed quantum states if you actually care about that.


It's in the text:

"The tensor product itself captures all ways that basic things can 'interact' with each other!"

Tensor Product is also the way to go when combining classical probabilistic systems.

And you need the tensor product already for pure states in QM.

(mixed states need density matrices)


>The tensor product itself captures all ways that basic things can 'interact' with each other!

In quantum physics, "interacting" usually has a different meaning. So one should use these terms more carefully.

>And you need the tensor product already for pure states in QM.

No. Pure states are just vectors (or more precise: rays) in Hilbert space. The usual inner product is sufficient to work with them. An outer (=tensor) product of these states will just give you a density matrix with tr(ρ^2)=1.


"Product states are multipartite quantum states that can be written as a tensor product"

"In the special case of pure states the definition simplifies: a pure state is separable if and only if it is a product state."

https://en.wikipedia.org/wiki/Separable_state


Keyword is can. There's a reason why most university level physics curricula defer quantum density matrices (and by extension tensor algebra) to more advanced classes. There's a lot of mathematical legwork required before you can actually make use of that.


Tensor product is basically the mathematical way to express if condition.

Say you have 2x2 matrix A, B, C.

Any arbitrary component within the Tensor(A, B, C) is:

  if A =(a1,a2) and B=(b1,b2) and C=(c1,c2): this value
The coordination is concatenation of matching dimension: (a1b1c1, a2b2c2)

While in many computational natural science, people using tensor product to store and manipulate data. Also it is how the mathematical equations being written on paper.

But in computer science's perspective, dealing with tensor matrix is simply a waste of memory since 90% of the time people are dealing with sparse system. System that their matrix is dominated by zero. Also it would be super clear if people just write if-then pseudocode instead of cryptic half-bake tensor expressions. People tend to invent their own notation while writting paper.


> Tensor product is basically the mathematical way to express if condition.

Not really, no. The way mathematicians actually express if conditions is with the word "if". The obvious pointlessly formal way to do it is with a pair of functions `ThingConditionedOn -> {0, 1}` and `{0, 1} -> Result`, but why would you?

> dealing with tensor matrix is simply a waste of memory since 90% of the time people are dealing with sparse system.

Tensors are not their components, any more than locations are their coordinates. Whether you choose a sparse or dense (or symbolic) encoding does not change the object being encoded.


> encoding does not change the object being encoded

Here I am talking about real memory space. There exist more efficient isometrical representation of the same object but since mathematicians don't usually know computer, inefficient tensor matrix is by default. That's the problem.


Not relevant for tensor product:

The author seems to be related to https://www.sandboxaq.com/.

"SandboxAQ leverages the compound effects of AI and Quantum technologies (AQ) to solve hard challenges impacting society."

This reads like a scam (don't know anything about it).


Very nice, but there’s a technical error in the section “in quantum physics”. A density matrix as described does not represent the state of two systems, just one system. I think the author is confusing a vector in H⊗H with a bounded operator on H.


This didn't demystify anything to me, I left it more mystified it than when I entered.


Very well written. The author should write textbooks.


If only those squiggles were readable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: