<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Emil Marinov on Medium]]></title>
        <description><![CDATA[Stories by Emil Marinov on Medium]]></description>
        <link>https://medium.com/@emilmarinov?source=rss-9e76fe700885------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pyy7mEZIdW4oqYCz7JjPng.jpeg</url>
            <title>Stories by Emil Marinov on Medium</title>
            <link>https://medium.com/@emilmarinov?source=rss-9e76fe700885------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 18:42:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@emilmarinov/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Pure, Mixed, and Entangled Quantum States]]></title>
            <link>https://medium.com/@emilmarinov/pure-mixed-and-entangled-quantum-states-84e8a4a8dd16?source=rss-9e76fe700885------2</link>
            <guid isPermaLink="false">https://medium.com/p/84e8a4a8dd16</guid>
            <category><![CDATA[quantum-mechanics]]></category>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[quantum-physics]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Emil Marinov]]></dc:creator>
            <pubDate>Tue, 09 Jan 2024 03:40:06 GMT</pubDate>
            <atom:updated>2024-01-10T00:29:23.248Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article aims to elucidate the different types of quantum states, how to represent them mathematically, and how to implement them into code using IBM’s python package Qiskit. A supplementary Jupyter notebook may be found at </em><a href="https://github.com/grayalienventures/quantum-articles">https://github.com/grayalienventures/quantum-articles</a><em>.</em></p><p><strong>Topics:</strong></p><ul><li>State Vectors</li><li>Bloch Sphere</li><li>Superposition</li><li>Entanglement</li><li>Density Matrices</li><li>von Neumann Entropy</li><li>Partial Trace</li><li>Qiskit</li></ul><h3>Pure States</h3><p>A fundamental operation in quantum computation is in representing and manipulating qubits, analogs to classical bits that can represent a <strong>superposition</strong> of different states until measurement, upon which point they decohere to a classical bit of value “0” or “1”. A single qubit may be represented via a <strong>Bloch sphere</strong>, a unit sphere with a vector originating at the origin and pointing to a position on the sphere’s surface 1.</p><p>The quantum analogs of the classical bits “0” and “1” are the qubits in states |0⟩ and |1⟩, respectively. The |0⟩ quantum state is represented by a vector that points to the north pole of the Bloch sphere along the z-axis, and the |1⟩ quantum state is represented by a vector pointing to the south pole. This may be observed in Figure 1.</p><p>The |.⟩ notation is called <strong>ket notation</strong> and was created by Paul Dirac as an alternate representation to column vectors. Similarly, the ⟨.| <strong>bra notation</strong> notation is used to rep- resent the row vector notation of a state. Together, they make up the <strong>bra-ket notation</strong>, which is obviously derived from the word “bracket”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/182/1*dFrwI7k4p2hNOZDpcnIMtQ.png" /><figcaption>Ket notation for the computational basis states.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hr6Mkf5ixyI52ujik_-wSw.png" /><figcaption>Figure 1: Qubits represented on the Bloch sphere, with qubit 0 in the |0⟩ state and qubit 1 in the |1⟩ state.</figcaption></figure><p>When a measurement is performed on the quantum state, it decoheres into a classical state. Measurements are performed using Hermitian operators, which are outside the scope of this article but are introduced for the sake of ambitious readers. One way to think about measurment is in the projection of the state vector along the z-axis. A qubit initialized to the |0⟩ state will always be measured as a “0”, assuming proper measurement technique and lack of technical malfunction, just as a qubit initialized to the |1⟩ state will always yield a “1”.</p><p>This concept can be modeled in Qiskit with the code below which creates a quantum circuit with one qubit and one classical bit, in which measurement will be stored, measures this qubit, and collects the results of 1024, by default, measurements. The QASM simulator is used to run the results locally via a random number generator; however, one may opt to run this code on an actual quantum computer by changing the backend to one of IBM’s providers. This can be done by creating an account at <a href="https://quantum-computing.ibm.com/login.">https://quantum-computing.ibm.com/login.</a></p><pre>qc = QuantumCircuit(1, 1)<br>qc.measure(0, 0)<br>backend = BasicAer.get_backend(’qasm_simulator’)<br>tqc = transpile(qc, backend)<br>counts = backend.run(tqc).result().get_counts()<br>plot_histogram(counts)</pre><p>When creating a quantum circuit, Qiskit automatically initializes the qubits to the |0⟩ state. To set the qubit to the |1⟩ state prior to measurememnt, a 2x2 matrix Pauli X operator, σₓ, is applied to it, rotating it around the x-axis by 180°. Note that a Pauli Y operator may have been applied to yield the same result as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SURHvoqWxH8MXUwFyzrlWg.png" /></figure><pre>qc = QuantumCircuit(1, 1)<br>qc.x(0)<br>qc.measure(0, 0)<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W5xhMeBAO1U-gfcxA6C1Bg.png" /><figcaption>Figure 2: Histogram of measurements taken on the |0⟩ state (left) and |1⟩ state (right).</figcaption></figure><p>Once again, notice how 100% of the measurements of |0⟩ and |1⟩ yield “0” and “1”, respectively. To harness the true power of quantum computation, a superposition must be imposed. If a vector pointing to the north pole of a qubit always yields a “0” and one pointing to the south pole always yields a “1”, then one pointing to a spot on the equator should yield a “0” ∼50% of the time and a “1” ∼50% of the time. This is achieved by rotating the qubit in the |0⟩ state by 90◦ to the equator with a <strong>Hadamard operator</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*czVfRmFmvopmpy34_b67IA.png" /></figure><p>The coefficient in front of each state is called the <strong>amplitude</strong>. It is a complex number governed by the <strong>Born rule</strong>, which states the square of the amplitude corresponds to the probability the system is in that state. For the state created above, there is an equal chance of measuring a “0” or “1”.</p><pre>qc = QuantumCircuit(1, 1)<br>qc.h(0)<br>qc.measure(0, 0)<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4xXcKKjSvhbQ2dbABDrMeQ.png" /><figcaption>Figure 3: The Bloch sphere after a Hadamard operator is applied to the |0⟩ state (left) and a histogram of 1024 measurements peformed on the state (right). Creating a state vector that yields a classical 0-bit when measured 75% of the time is left as an exercise to the reader.</figcaption></figure><p>Another useful method in describing a quantum state is with a <strong>density matrix</strong>. To generate a density matrix, simply take the summation of the product of each contributing quantum state’s state vector’s outer product with itself and the probability of finding the system in this state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JIb2z_XmXVgYmFItIn02Xg.png" /></figure><p>The density matrix of the the |+⟩ state from Equation 3 is calculated below. Once it is generated, one can check that the Born rule for matrices, or that tr(ρ) = 1, is satisfied. Also, note that there is only one state that is dealt with currently, meaning the probability of the system being in this state is inherently 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b-0M0yrrQ__Ikk0iVPP4Ag.png" /></figure><p>In Qiskit, the density matrix may be generated by using the <em>DensityMatrix</em> function from the <em>qiskit.quantum_info</em> package.</p><pre>qc = QuantumCircuit(1, 1)<br>qc.h(0)<br>dm_plus = qi.DensityMatrix(qi.Statevector(qc))</pre><p>One of the applications of the density matrix is in calculating the entropy of the system to categorize the quantum system into a pure or mixed state. In particular,<strong> von Neumann entropy</strong>, which is a function of the density matrix’s eigenvalues, is used for this purpose. For the sake of brevity, eigenvalue calculation has been omitted; however, the standard method of determining eigenvalues by finding the null space of the characteristic equation is used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tXOW6KTT09my0nKg5enP2g.png" /></figure><p>Computing the |+⟩ state’s entropy as an example, begin by finding its eigenvalues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Tpy7qZTohZevHPj-NQZrA.png" /></figure><p>Then, plug them into Equation 10. As the log of 0 is undefined, L’Hôpital’s rule shall be used to yield “0” when the eigenvalue is 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*adwjvyOWV8sjS3BUUOJOXg.png" /></figure><p>The same result may be achieved using Qiskit.</p><pre>entropy = qi.entropy(dm_plus)</pre><h3>Mixed States</h3><p>Unlike a pure state which is entirely known and may be represented with a state vector, a mixed state is an ensemble of pure states with a probablity associated to each one. Mixed states represent uncertainty in a quantum system, like when noise is introduced. To demon- strate this concept, a mixed state associated with a 30% chance of it being in the |0⟩ state and 70% chance in the |1⟩ state is introduced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FB9-E8j3fkvfPpGVxbNN_w.png" /></figure><p>Using the same method as in the above section yields a von Neumann entropy of 0.88. Code was generated to plot von Neumann entropies versus a range of probabilities, <em>probs₀</em>, for the system to be in the |0⟩ state, assuming the probability of the |1⟩ state is <em>1 − probs₀</em>.</p><pre>def entropy_mixed_state(prob_0, prob_1):<br>    mixed_state = prob_0 * DensityMatrix.from_label(’0’) + \<br>        prob_1 * DensityMatrix.from_label(’1’)<br>    return qi.entropy(mixed_state)<br>probs_0 = np.linspace(0, 1, 101)<br>entropies = [entropy_mixed_state(p0, p1) \<br>    for p0, p1 in zip(probs_0, 1-probs_0)]<br>plt.plot(ps, entropies)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*SBTK3YGIclp2-PxwzvKXSg.png" /><figcaption>Figure 4: Notice how entropies are 0 for the pure states associated with a 0% and 100% chance of the |0⟩ state and 0.5 for the maximally mixed state where as little as possible is known about which pure state the ensemble is really in.</figcaption></figure><h3>Entanglement</h3><p>Entanglement refers to a collection of qubits that cannot be described without one another. A common analogy is to consider a set of ”entangled” books where reading an element of this set cannot be understood without reading all the others. Another analogy is if one were to place a red and blue sock into their own boxes and have someone who did not observe the placement randomly pick a box, it would be instantly known that the other box contains a blue sock, assuming the person selected a red sock. This case falls short in explaining quantum entanglement, as it is deterministic and there exists a “hidden variable” in prior knowledge of the sock colors, indicating information is not being transmitted faster than the speed of light. Bell’s inequalities proved there exist no hidden variables in entangled particles, and that either the locality or causality, or both, that are associated with classical physics do not hold true. Entanglement is not as esoteric of a concept as is typically thought; in fact, the electrons of a Helium atom are entangled, for example.</p><p>The maximally entangled |ψ+⟩ Bell state is used as an example in this section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2eWE82W_mQMnfrP901Ztrg.png" /></figure><p>A quick and simple method of generating the density matrix is to enumerate the possible combinations the qubits could take along the columns and rows, and to list their ampli- tudes in the corresponding grid. Satisfiability of the Born rule may be verified by ensuring tr(ρψ+ ) = 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*wQNyKYJA4R6psNYP7GoQIA.png" /></figure><p>Factoring the density matrix above into two separate product states where the tensor product of these 2x2 matrices yields the density matrix is an exercise left to the reader that is guaranteed to never be solved correctly. The inability to perform this task is one of the ways an entangled state may be recognized. A real non-prank exercise to the reader, however, is to factor an unentangled two-qubit 4x4 density matrix into its two constituent 2x2 product state matrices.</p><p>The von Neumann entropy of the system using is determined to be 0, meaning this maximally entangled Bell state is a pure state. The next question to explore is what is the entropy of just one of those qubits, for example the second qubit, which shall be denoted qubit B.</p><p>The first step is to determine the density matrix of qubit B by “tracing out” qubit A by taking the <strong>partial trace</strong> on the density matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sk6s2-WGBC548QotKS223w.png" /></figure><p>Let’s now take some example terms from the above and solve them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-yBC7QtDXlAM-daE_xHW2Q.png" /></figure><p>Notice how the ⟨0A|1A⟩ inner product at the very beginning cancels the rest of the term out, as it is orthogonal, and thus, 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JIhv0VcVhLYG-jPcL6ilHA.png" /></figure><p>In the term above, the two inner products on the outside of the term, ⟨0A|0A⟩ and ⟨0B|0A⟩, equal 1, leaving just the remaining outer product on the inside. Using the previous two terms as examples, it is apparant that all of the terms except for two will cancel out, leaving behind the density matrix:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TWRk9aSyGWKWsMixdxKJlw.png" /></figure><p>Solving for von Neumann entropy yields the maximal possible value of 1. This is consis- tent with the definition of entanglement where neither of the states of the entangled particles can be interpreted without the other(s). A traced out qubit is just one example of a mixed state where uncertainty is represented via a density matrix. Note that it is convention to use log base 2 in these calculations; however, any base will yield a relatively correct value, just one that is scaled differently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GDEiDfaizcsyTeExWEM5aw.png" /></figure><h3>Conclusions</h3><p>Pure states, including entangled states, have entropies of 0, whereas mixed states have non- zero entropies. The partial trace allows us to “trace out” a qubit and measure entropy on the remaining qubit(s) to determine purity.</p><h3>Exercises</h3><ol><li>Using Qiskit, initialize a state vector that measures “0” ∼75% of the time and a “1” ∼25% of the time.</li><li>Create a mixed state with the |0⟩ and |+⟩ states and plot von Neumann entropy versus probability that the system is in the |0⟩ state, probs_0, assuming the probability that the system is in the |1⟩ state is 1 − probs_0.</li><li>Come up with an unentangled two-qubit system, generate its density matrix, and factor out its product states. Confirm that the tensor product of these states yields your system’s density matrix.</li><li>Generate the density matrices associated with three pure states and three mixed states of your choosing. Determine tr(ρ²) for each of them. What do you notice?</li></ol><h3>Acknowledgements</h3><p>Appreciation is expressed to Dr. Eliot Kapit and Dr. Lincoln Carr for guidance, Pratik Patniak for being the best TA I’ve ever had, Dr. Robert Richmond and Dr. Marc Liggins for all the intellectual conversations, and last but certainly not least, Dr. James Richard Lennon for all his work with the Lie algebras of non-Hermitian k-local Hamiltonians of coupled harmonic oscillators into which NP-complete problems may be translated and simulated.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84e8a4a8dd16" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>