How to calculate the posterior distribution with a normal likelihood function and a prior that involves sigma

In the problem, the data X follows a normal distribution, or $$f(x|\mu,\sigma^2) = \frac{1}{\sqrt{2\pi\sigma^2}}\exp(-\frac{1}{2}(\frac{x-\mu}{\sigma})^2)$$. Let's say I know the value of $$\sigma^2$$ and want to find the posterior distribution of $$\mu$$, and I choose a prior distribution of $$p(\mu, \sigma^2) = \frac{1}{\sigma^2}$$. My understanding here is that the posterior distribution is calculated as $$p(\mu|x, \sigma^2) = f(x|\mu,\sigma^2)p(\mu, \sigma^2)$$, or basically $$\frac{1}{\sqrt{2\pi\sigma^2}}\exp(-\frac{1}{2}(\frac{x-\mu}{\sigma})^2)$$ times $$\frac{1}{\sigma^2}$$. And I understand that the goal here would be to arrive at something that still looks like a normal distribution for my posterior distribution, so that I can just draw from this normal distribution with some modified parameters to do what I want with the posterior.

What I'm stuck on is how I multiply those two equations together in a way that achieves that. How do I work in that $$\sigma^2$$ quantity and arrive at a posterior distribution that utilizes it somehow?

The posterior distribution on $$(\mu,\sigma)$$ is $$p(\mu,\sigma|x)\propto p(\mu,\sigma)f(x|p(\mu,\sigma))=\frac{1}{\sqrt{2\pi\sigma^2}\sigma^2}\exp\left\{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2\right\}$$ However, the rhs integrates to infinity, hence one cannot use this improper prior with a single observation $$x$$.
If the only parameter is $$\mu$$, meaning that the value of $$\sigma^2$$ is known, then, using a flat prior on $$\mu$$, $$p(\mu|x)\propto p(\mu) f(x|\mu)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp\left\{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2\right\}$$ is a well-defined probability distribution, meaning that the posterior on $$\mu$$ is a Normal $$\mathcal N(x,\sigma^2)$$ distribution.
• Xi'an, perhaps $p(\mu)$ in the second posterior distribution might be a typo (or am I missing something?). Commented Feb 2, 2023 at 11:59