Zulip Chat Archive

Stream: Is there code for X?

Topic: Outer product of two vectors


Niels Voss (Dec 21 2025 at 10:55):

Given v : E and w : F where E and F are finite-dimensional inner product spaces, how do you construct the outer product wvα΄΄ : E β†’β‚—[π•œ] F, where α΄΄ denotes the conjugate transpose? I guess you can do dualTensorHom π•œ E F (InnerProductSpace.toDualMap π•œ E v βŠ—β‚œ[π•œ] w), but is there a better way?

Kevin Buzzard (Dec 21 2025 at 15:13):

It's the composite of two linear maps E->k and k->F, the first of which only depends on v and the second of which only depends on w. No doubt we have the first, I don't know about the second, but if we have both of these then probably the easiest way to make it is as the composite. Note that you only need E to have a bilinear form and you don't need anything to be finite-dimensional.

Aaron Liu (Dec 21 2025 at 15:19):

like this?

import Mathlib

variable {π•œ : Type*} [RCLike π•œ] {E F : Type*} [SeminormedAddCommGroup E] [AddCommGroup F]
    [InnerProductSpace π•œ E] [Module π•œ F]

def outerProduct (w : F) (v : E) : E β†’β‚—[π•œ] F :=
  .comp (LinearMap.toSpanSingleton π•œ F w) (innerβ‚›β‚— π•œ v)

Aaron Liu (Dec 21 2025 at 15:20):

I could probably bundle this further as being conjugate-linear in v and linear in w

Niels Voss (Dec 21 2025 at 22:14):

Is this something we want as a definition in mathlib?

Aaron Liu (Dec 21 2025 at 22:17):

since it's so short I think probably not?

Niels Voss (Dec 21 2025 at 22:19):

I guess it also depends on how many useful theorems can be stated about the outer product, and whether this would help or hurt discoverability

Aaron Liu (Dec 21 2025 at 22:41):

I feel like this would be more naturally stated with v : E β†’β‚—[π•œ] π•œ instead of v : E

Aaron Liu (Dec 21 2025 at 22:41):

the inner product isn't really doing anything besides attach the space to its dual

Niels Voss (Dec 21 2025 at 23:34):

This makes sense

Jireh Loreaux (Dec 22 2025 at 02:17):

Yes, although we probably want a version both for docs#Module.Dual and also docs#StrongDual. Then for Hilbert spaces we can have an abbrev.

Niels Voss (Dec 22 2025 at 02:18):

Do we want a version that converts a vector to its dual or should we follow Aaron's suggestion?

Jireh Loreaux (Dec 22 2025 at 02:45):

I'm saying the same thing as Aaron. You shouldn't take two vectors, but rather a functional and a vector.

Niels Voss (Dec 22 2025 at 02:47):

and should this go into mathlib?

Jireh Loreaux (Dec 22 2025 at 04:00):

I would like to see it, yes. This is a standard thing that comes up. For instance, I think @Monica Omar used this to show that the center of the continuous linear maps are just the scalar ones.

Monica Omar (Dec 22 2025 at 15:31):

there's this PR #27668 by @IvΓ‘n Renison, but it's been a few months since it's been updated

IvΓ‘n Renison (Dec 22 2025 at 19:52):

Yes, I didn't continue because I was not convinced about what I was doing with the suggestions

IvΓ‘n Renison (Dec 22 2025 at 19:52):

Especially the name, I have always called it outer product, so naming it rankOne seems quite strange for me

IvΓ‘n Renison (Dec 22 2025 at 19:53):

But I should I continue ir. I will try to in the next days


Last updated: Feb 28 2026 at 14:05 UTC