# What happens to $|y\rangle \sum_{x}|x\rangle|f(x) + g(y)\rangle$ when we throw away the first register?

Let's suppose, that applying $$\mathbf{H}$$ (Hadamard operator) to the first register of the state $$c \cdot \sum_{x}|x\rangle|f(x)\rangle$$ ($$f$$ is a permutation, $$c$$ is a normalization factor), and measuring the first register gives $$|0\rangle$$ with some probability $$p$$.

Now consider the state $$c \cdot |y\rangle \sum_{x}|x\rangle|f(x) + g(y)\rangle$$, where $$|x\rangle$$ and $$|y\rangle$$ are not entangled, $$c$$ is again a normalization factor. Will it be correct, if I "throw away" $$|y\rangle$$ and apply the statement above to the second and third register treating $$g(y)$$ as a random value with some distribution, that is writing the state as $$\sum_{x}|x\rangle|f(x) + s\rangle$$, where s is random, but fixed.

In other words, am I able to consider only a subspace of the whole space treating values that involve $$y$$ as random values?

• Welcome to QCSE! What is $c$? Is it just a normalization factor? And also, what exactly is $\mathbf{H}$? Also in the state $$c \cdot \sum_x |y\rangle |x\rangle |f(x) + g(y)\rangle \,,$$ the $|y\rangle$ does not seem to have any dependence on $x$. Then why are you keeping it inside the summation? The question is very confusing. Please add details and clarify things. Feb 7 at 0:01
• @FDGod $c$ is a normalization factor, $\mathbf{H}$ is Hadamard operator, $|y\rangle$ does not depend on $x$ (kept inside the sum just to write three registers together). Edited. Feb 7 at 0:21

After throwing the first register away the state of the second and third registers becomes $$|\psi_{23}\rangle=\sum_x|x\rangle|f(x)+s\rangle\tag1$$ where $$s$$ is a fixed value. More precisely, $$s:=g(y)$$ where $$y$$ is whatever was in the first register.

## Partial trace

Mathematically, discarding a register corresponds to the partial trace, so to prove $$(1)$$, we perform the following calculation \begin{align} \rho_{23}&=\mathrm{tr}_1\rho_{123}\tag2\\ &=\mathrm{tr}_1\left[|y\rangle\sum_x|x\rangle|f(x)+g(y)\rangle\langle y|\sum_{x'}\langle x'|\langle f(x')+g(y)|\right]\tag3\\ &=\mathrm{tr}_1\left[|y\rangle\langle y|\otimes\sum_x|x\rangle|f(x)+g(y)\rangle\sum_{x'}\langle x'|\langle f(x')+g(y)|\right]\tag4\\ &=\mathrm{tr}_1\left[|y\rangle\langle y|\right]\cdot\sum_x|x\rangle|f(x)+g(y)\rangle\sum_{x'}\langle x'|\langle f(x')+g(y)|\tag5\\ &=1\cdot|\psi_{23}\rangle\langle\psi_{23}|\tag6 \end{align} where subscripts indicate registers.

The conclusion actually applies more generally. If the register $$1$$ is not entangled with other registers, then discarding the register $$1$$ corresponds to merely dropping the corresponding ket from the initial state. Here, register $$1$$ is not entangled with registers $$2$$ and $$3$$, because we can write our initial state $$|y\rangle\sum_x|x\rangle|f(x)+g(y)\rangle$$ as a product $$|y\rangle\sum_x|x\rangle|f(x)+g(y)\rangle=|y\rangle\otimes|\phi(y)\rangle\tag7$$ where $$|\phi(y)\rangle=\sum_x|x\rangle|f(x)+g(y)\rangle$$.

## Randomness of $$s$$

Note that $$s$$ does not become random as a result of the partial trace in the calculation above (as it would if the registers were entangled as in for example $$\sum_{x,y}|y\rangle|x\rangle|f(x)+g(y)\rangle$$). You can treat $$s$$ as a random variable, but this is a modeling choice, not a necessity arising from quantum theory. For example, $$y$$ might be unknown or uncertain and you may choose to model that by declaring $$y$$ to be a random variable. In this case, $$s$$ is a random variable, too (unless of course $$g$$ is constant).

If $$y$$ is a bitstring, meaning $$|y\rangle$$ is a basis state, yes, you can just throw it away since it is not entangled with the rest of the state.

However, if you had something like $$\sum_y|y\rangle\sum_x|x\rangle|f(x)+g(y)\rangle$$, this wouldn't work anymore, since the first register would be entangled with the last one.