Is it mathematically problematic to consider the complex space of real(!)-valued functions?

Emphatically yes! There's a very common technique used in the spectral theory of operators of finite-dimensional vector spaces that makes this precise.

Let's think, for a moment, about exactly what a vector space is. It's an abelian group (bunch of objects with a notion of addition) and a field (bunch of objects with a notion of addition, multiplication, and division), and some way for the field to act on the group ("scalar multiplication"). But we actually don't need division for the rest of that to make sense. So we can drop it; the "generalized vector space" we get that way is called a module.

If you've never heard of modules, that sounds really abstract, so an example might be helpful. Take $\mathbb{Z}^3$. This is just vectors in three-space with integer coefficients. Clearly we still can't scalar-multiply by real numbers and stay in our space, but it does make sense if our notion of "scalars" is $\mathbb{Z}$. This space shares many of the features of vector spaces, but he end result of RREF has things that are not $1$ on the diagonal. You might wonder why anyone would be interested in this space; it is useful for crystallographers, and diophantine equations (in addition to just pure math).

The reason I bring this up is that, given a linear operator $T$ on a module $M$ over ("with scalars") $R$, we can turn $M$ into a $R[x]$-module by defining "multiplication by x" to be applying $T$. Because $T$ is linear, multiplication will be distributive the way we want it to be. Proving that we satisfy the definitions is just some elementary algebra.

This is useful for spectral theory because the modules naturally decompose into generalized eigenspaces.

In our scenario, let $T=H$ and $M=L^2(\mathbb{R})$ over $\mathbb{R}$. Now $M$ is naturally an $\mathbb{R}[x]$-module. But so too is $\mathbb{R}[x]$! So we have a homomorphism (of $\mathbb{R}[x]$-modules) $\phi\in\mathbb{R}[x]\to M$ given by the $\mathbb{R}[x]$ module action. But we know that for all $f\in L^2(\mathbb{R})$, $H^2(f)+(t\mapsto1)=0$. So, translating into module terms, for all $f$, $(x^2+1)f=0$. Equivalently, $(x^2+1)\subseteq\operatorname{ker}{(\phi)}$. So by the First Isomorphism Theorem, $\phi$ factors through the canonical quotient map $\theta\in\mathbb{R}[x]\to\mathbb{R}[x]/(x^2+1)$. As $\mathbb{R}[x]/(x^2+1)\cong\mathbb{C}$, this means there is a canonical $\mathbb{C}$-action which is exactly as you describe.

I would be careful, though. This is not an algebra homomorphism, which is a fancy way of saying that you can't expect multiplying two $L^2$ functions together to play well with multiplying by a complex number. But you already knew that anyways--you can't multiply two $L^2$ functions together to get something$L^2$ anyways.


Jacob Manaker's answer is excellent, and since you seem to be after something purely algebraic this is the way to go. You can also directly show that $L^2(\mathbb R)$ with the defined multiplication satisfies the vector space axioms, but Jacob Manaker's answer is more elegant and has other applications.

However, given the natural Hilbert space structure of $L^2$, another interesting question is what kind of inner products we can endow this vector space with. Of course, any vector space can be equipped with inner products, but they are unlikely to have anything to do with the space's structure as a function space. So, a natural question arises: what does a suitable inner product look like? Note: for the remainder of this answer I will use $\alpha x$ to refer to regular multiplication by $\alpha\in\mathbb C$ and $\alpha\cdot x$ to refer to this newly defined multiplication.

The problem is in finding a space which can act as the analogue of $L^2(\mathbb R)\subset L^2(\mathbb C)$, or $\mathbb R^n\subset\mathbb C^n$. In other words, we need a $\mathbb R$-vector subspace $E\subset L^2(\mathbb R)$ such that $L^2(\mathbb R)=E\oplus i\cdot E$. I originally did not see the obvious example (and instead argued existence using the axiom of choice - see edit history for the details if you are interested, but it is a very standard Zorn's lemma argument), but after the OP's comment I have realized that taking $E$ to be the subspace of even functions will suffice. Indeed, for any $f\in L^2(\mathbb R)$,

$$f(x)=\underbrace{\left[\frac{f(x)}2+\frac{f(-x)}2\right]}_\text{even}+\underbrace{\left[\frac{f(x)}2-\frac{f(-x)}2\right]}_\text{odd}$$

and if $f$ is both even and odd, then clearly $f=0$. Moreover, $Hf$ is odd for any even $f$ and even for any odd $f$, which implies that $i\cdot E$ is the space of odd functions. To define an inner product is now quite natural: if $f=u_1+i\cdot v_1$ and $g=u_2+i\cdot v_2$ where $u_i,v_i\in E$ then define $$\langle f,g\rangle:=\int(u_1u_2+v_1v_2)\,dx+i\int(v_1u_2-u_1v_2)\,dx.$$ Note that $\langle f,g\rangle=(\Phi(f)|\Phi(g))$, where $(\cdot|\cdot)$ is the standard inner product on $L^2(\mathbb C)$ and $\Phi(u+i\cdot v)=u+iv$ is linear, so it follows that this is indeed an inner product. Moreover, this inner product makes $L^2(\mathbb R)$ a Hilbert space. Indeed, suppose $(f_n)$ is Cauchy and write $f_n=u_n+i\cdot v_n$ where $u_n,v_n\in E$. Notice that $\langle f_n,f_n\rangle=\|u_n\|_2^2+\|v_n\|_2^2$, so both $\{u_n\}$ and $\{v_n\}$ are Cauchy sequences in $L^2$ (in the traditional sense). Since $E$ is a closed subspace of $L^2$, there exist $u,v\in E$ such that $u_n\to u$ and $v_n\to v$ in $L^2$. Put $f=u+i\cdot v$. Then $$\langle f_n-f,f_n-f\rangle=\|u_n-u\|_2^2+\|v_n-v\|_2^2\to0,$$ so indeed $(L^2(\mathbb R),\langle\cdot,\cdot\rangle)$ is a Hilbert space.