Let $A$ and $B$ be $*$-algebras, with $A=pBp$ for some projection $p\in B$. Suppose we have an element $x\in A$ such that $x=b^* b$ for some $b\in B$.
Question: Is it true that $x=a^*a$ for some $a\in A$?
Thoughts: I suspect that this is false in general, although it seems to be true if $A$ and $B$ are $C^*$-algebras, by spectral permanence. But an explicit example of $*$-algebras $A$ and $B$ for which this is false (or a proof that it is true in general) would be appreciated.
Added later: If it helps, we may assume that $A$ and $B$ can be given norms so that they become $C^*$-algebras after completion with respect to these norms.
Yes it is true. As a reminder the spectrum $\sigma_A(x)$ of an element of $A$ is defined to be:
$$\sigma_A(x)=\{\lambda \in\Bbb C\,\mid x-\lambda\Bbb 1\text{ is not invertible in }\widetilde A\}$$ here $\widetilde A$ is a unitisation of $A$ if $A$ is not unital, othewise it is $A$. Now if $A\subseteq B$ is a $C^*$-subalgebra you have $\sigma_A(x)\cup \{0\} = \sigma_B(x)\cup\{0\}$ for any $x\in A$, that is the spectrum changes at most by adding a zero.
An element $x$ of a $C^*$-algebra $A$ is positive if and only if any of the following equivalent conditions hold:
In particular if $x=b^*b$ for a $b\in B$ you have that $x$ is positive in $B$, hence $x$ is self-adjoint and $\sigma_A(x)\cup\{0\}=\sigma_B(x)\cup\{0\}\subseteq \Bbb R_{≥0}$, whence $x$ is positive in $A$ and you find an $a\in A$ for which $a^*a=x$. So the notion of positivity is independent of including your algebra in a bigger one.
The above equivalences can be found in any book in $C^*$-algebras, like Murphy or Bratteli-Robinson.