Abstract
We present the problem of approximating the time-evolution operator to error , where the Hamiltonian $\hat{H}=(\langle G|\otimes\hat{\mathcal{I}})\hat{U}(|G\rangle\otimes\hat{\mathcal{I}})$ is the projection of a unitary oracle onto the state created by another unitary oracle. Our algorithm solves this with a query complexity to both oracles that is optimal with respect to all parameters in both the asymptotic and non-asymptotic regime, and also with low overhead, using at most two additional ancilla qubits. This approach to Hamiltonian simulation subsumes important prior art considering Hamiltonians which are -sparse or a linear combination of unitaries, leading to significant improvements in space and gate complexity, such as a quadratic speed-up for precision simulations. It also motivates useful new instances, such as where is a density matrix. A key technical result is `qubitization', which uses the controlled version of these oracles to embed any in an invariant subspace. A large class of operator functions of can then be computed with optimal query complexity, of which is a special case.