An educational model of the Deutsch algorithm for secondary school

In this paper, we present the outline of an educational path to introduce a crucial historical turnpoint of quantum information research—namely the Deutsch algorithm—to secondary school students. We discuss a basic elementarization strategy allowing students to single out and focus on the individual features of quantum mechanics involved in the different steps of the algorithm information processing phase, which can potentially be useful for the educational reconstruction of other algorithms and protocols. The sequence includes the experimental realization on the optical bench of an analogue of the Deutsch algorithm, working with classical coherent light. The educational path was tested both in curricular and out-of-school settings, and preliminary results will be discussed.


Introduction
Considerable interest has arisen in the past few years on making the topics related to modern quantum technologies accessible to teachers and educators at all levels.Far reaching institutional projects, such as the Quantum Flagship [1] in the EU; the National Quantum Initiative [2] in the US; the National Quantum Technologies Programme [3] in the UK, while centered on fundamental research, have also sustained the expansion and improvement of education and professional training on quantum technologies.In recent works, several authors have proposed courses, tools and strategies in an effort to advance the scope of education to quantum mechanics (QM) in secondary school to include topics related to the 'second quantum revolution' [4][5][6].In this article, we discuss an educational model of a basic version of the Deutsch algorithm using only two qubits.The model consists essentially of a modified Mach-Zehnder interferometer, suitable to be discussed with secondary school students.We also present preliminary results from the first experimentations.

The Deutsch algorithm
The Deutsch algorithm is a special case of the Deutsch-Jozsa algorithm, formulated in 1992 [7] and perfectioned in 1998 [8].The goal of the Deutsch-Jozsa algorithm is to determine whether an unknown but constrained function { } { }  f : 0,1 0,1 n is constant (its output value is always 0 or always 1, for all input values) or balanced (its output is 0 in exactly half the possible cases, and 1 otherwise).The function f is a priori constrained to be either constant or balanced.The Deutsch algorithm is the special case in which n = 1, which was treated by David Deutsch already in 1985.
For a classical algorithm, answering the above problem with certainty requires queries to the function f .The quantum Deutsch-Jozsa algorithm, however, can find deter- ministically the correct answer with a single evaluation of f [8].The Deutsch-Jozsa algorithm has a high educational value for its simplicity; furthermore, it allows to highlight elementary features of the process of elaboration of information in quantum computation which, we believe, can be transposed with some generality to other algorithms and protocols, and provide a significative scaffolding element for students' understanding of quantum computation.In the following, we restrict ourselves to discussion of the Deutsch algorithm.
In order to make the following exposition clearer, it may be useful to first recapitulate some terminology regarding-qubits.A qubit is a basic unit of quantum information and can be realized using any two-state quantum system, whose eigenstates are conventionally labeled as It may be useful to express the complex coefficients α and β in terms of modulus and phase, i.e. a = In this representation, the angle j may be called the global phase of the state, and it is often ignored since it has no physical meaning, while f is the relative phase between the two components of the state, which plays a crucial role in quantum phenomena.As noted in section 3, in our sequence with students, we restrict to real values of α and β, so that the relative phase f can only take the values 0 or π.
The circuital representation of Deutsch's algorithm is reported in figure 1.The algorithm uses two qubits (also called registers 4 ) initialized in the state | ⟩ | ⟩| ⟩ y = 0 1 .

0
In the initial step of the algorithm, both qubits go through Hadamard gates, defined by their action on basis states: In other words, in the usual vector representation in which ( ) the Hadamard gate corresponds to the matrix ( ) As a consequence, the composite system state at the output of the Hadamard gates becomes This step can be considered as an instance of a first general characteristic of quantum computation processes: we call it the enablement of parallelism, through the construction of an equal-weight superposition of basis states.
The second stage of the algorithm consists in applying the oracle function, which is defined by the following operation on a generic state where the symbol ⊕ represents binary sum, which, in the present context, is equivalent to the XOR gate since there is no carry bit (see table 1) The action of the oracle transforms the state 2 Now, since ( ) f x can give only the values zero or one, the state of the second register remains unchanged except for a possible minus sign depending on the value of ( ) f x , which can also be seen as a relative phase between the two components of the first register.For example if ( ) Considering all cases, equation (3) can be rewritten as In this step we can see a second general characteristic of quantum algorithms which may be important in their educational presentation: the exploiting of the multiplicative structure of compound quantum states, which allows phases gained by one qubit to be considered indifferently as attached to a different qubit in a product state.After this stage in the algorithm, the second register is no longer used, while the first one passes through a second Hadamard gate.By inspection of equation (4), one can see that the gate transforms the register value to | ⟩ 0 (up to a global phase) if the function f is constant, to | ⟩ 1 (up to a global phase) if it is balanced.More formally, the state | ⟩ y 3 after the Hadamard gate may be written as And this can be regarded as the third important characteristic appearing in the Deutsch algorithm: the activation of interference to suppress the state components for the measured register which correspond to an incorrect answer.The suppression is not complete for all algorithms, which means not all quantum algorithms provide a deterministically correct result in the first run (e.g.Shor's algorithm).

Related work
In this section, we offer an overview of some research work which, in different ways, is related to our own.Concerning the educational reconstructions of quantum algorithms, Satanassi et al [5] identified a basic design principle of their work in the reconceptualization of the three main phases of foundational experiments (preparation of a state-transformation of the state-measurement) in terms of computation (input information-processing-output information).While such informational interpretation of quantum processes is educationally productive, we felt that more work was needed in order to clarify the structure of quantum algorithms.In particular, we studied whether the central phase-information processingcould be further subdivided into a sequence of elementary operations to help students build a clear picture of quantum algorithms and their operational advantages.A possible realization of the Deutsch algorithm with classical light was proposed by Vianna et al [9] and in a similar fashion by Puentes et al [10] who also implemented the Grover algorithm.The basic idea is to represent classically the quantum amplitude of a n-qubit state using the complex amplitude of a laser beam over each one of 2 N localized areas of the optical scene (the portion of space illuminated by the beam).A modulation, in both amplitude and phase, of the beam allows to 'prepare' the initial state, and then transformations (logic gates) are performed by means of suitable lens systems.While this kind of realization has educational advantages (for example, it makes crystal clear that an exponential scaling of resources is necessary to classically simulate a quantum computer) it also requires the quite abstract capability to reason directly in terms of transformations in the full Hilbert space of a quantum system.Our approach stems instead from the idea of using primarily the conceptual resources acquired in the context of a basic introduction to quantum physics using a two-state polarization approach for moving the first steps into quantum computation.Furthermore, we believe that representing qubits as separate degrees of freedom, each one with two clearly identifiable alternatives, can be advantageous for students' understanding in their initial stages of learning.
While the ideal experimental design discussed in this article is fully quantum, including single photon sources and counters, in the lab it has been presented to students by using coherent light from a laser, the intensity of which is interpreted in terms of large numbers of photons (superpositions of Fock states are not discussed).In an undergraduate experiment the laser and CCD cameras could be replaced by single photon devices, leaving the optical bench unaltered.In this sense, the experimental part of our work falls within a vast research tradition of using interferometry experiments in education to highlight some aspects of QM, both in high school [11] and university instruction.In the latter setting, research is especially abundant, as can be seen from the comprehensive review by Galvez [12]: for example, the basic setup of the Mach-Zehnder interferometer alone has been used to demonstrate single photon [13] and two photon [14] interference, the quantum eraser [15,16] also with nonlocal control of the erasure efficiency by manipulation of the polarization state of an entangled secondary photon [17], the Hanbury-Brown-Twiss test [16].
The basic idea of using a modified Mach-Zehnder interferometer to represent the Deutsch algorithm is also not new, as it was adopted in [8].However, in [8], which is not an educational paper but a research paper, the correspondence between the quantum circuit represented in figure 1 and the optical device is not trivial, as only one qubit is explicitly coded in the analysis of Mach-Zehnder.Our work was aimed at maximizing the educational effectiveness of the model, by obtaining a one-to-one correspondence between elements of the quantum circuit and elements of the optical device.For representing two different qubits, we used a mixed coding, in which one register corresponds to a polarization state, and the second to which-path information, in a similar way to what is done in [18], although with a different coding for spatial states which will be discussed in section 2.5.In the educational literature a similar approach, limited to the analysis of the Mach-Zehnder system, is adopted in [19].

Prerequisites and preliminaries
Complex numbers are not used in the sequence, since the relevant phase shifts introduced are all of p  and correspond to the application of a minus sign to either one or both the components of a superposition state.Thus, mathematical prerequisites are limited to basic algebra, with some linear algebra (e.g.matrices and vectors) being desirable but not strictly required, and classical Boolean logic, including the truth tables of the most important logic gates.Concerning this last point, formal instruction in Italian schools has a wide range of variability, thus a 1-2 h introduction/refresh on the topic (not discussed in this paper) was necessary.As it will be seen in section 4, the course was tested with at least acceptable educational results with students with no background in electromagnetism or light polarization, and only assuming knowledge of basic wave phenomena.However, the learning path here described is preceded by an introduction lasting about 5-6 h on basic quantum theory based on a two-state approach, with a structure similar to the one of [20].Such introduction will not be discussed in this article.

Teaching methods
Excepting the laboratory session, which will be discussed in section 4, instruction proceeds through a variety of activities, including lectures based on slides, but also inquiry-based and modelling tasks described in two-three page worksheets.Worksheets are to be completed by students step by step in suitable short pauses of the lesson flow, and are designed to emphasize written explanations of student reasoning [20].
The main teaching blocks leading to the introduction of the Deutsch algorithm are: the introduction of polarization encoding (3 h); the introduction to spatial mode encoding (2 h); composite two-qubit gates (1 h), and the Deutsch algorithm itself (2 h).These blocks will be discussed in the following.

Polarization encoding of qubits
The fundamental tools needed to build polarization-based logic gates by means of materials already familiar from the introductory part of the course (i.e.birefringent crystals) are phase shifting materials.With students we initially introduce the electromagnetic description of light in an elementary form.Since the direction of the linear polarization of light is identified by the electric field vector, we focus only on the mathematical expression for such quantity.We recall the concepts of global phase, of phase difference and its role in wave interference.Finally we present students with linear isotropic dielectrics, i.e. for our purpose, phase shifting materials that do not change the direction of polarization.Since in the course we only work with real numbers, the basic phase shifting device will be a sheet of refractive material, whose refractive index and thickness are designed to obtain, for waves of the chosen wavelength, a phase shift of π.
In order to make precise the correspondence between the representations of polarization states in terms of the inclination of the plane of oscillation of the  E field (as commonly given in secondary school textbooks) and in terms of abstract state vectors, we first express the electric field vector as a polarization vector.Since we are interested only in the direction of linear polarization and the relative phase of the orthogonal components of the wave, we use a representation in terms of Jones vectors [21], i.e. we omit the spatiotemporal elements from the cosine, normalize the amplitude of the vector and set the global phase to zero.For a field oscillating in an arbitrary direction, the result is a normalized Jones vector: Since we restrict us to linear polarization, the coefficients of the Jones vector are real; if the value of only one coefficient is negative, this corresponds to a phase difference of π between the two components.The mathematical expression is identical to that of a generic quantum state of linear polarization of a photon.At this point, all the conceptual instruments required to build logic gates acting on one polarization-encoded qubit are available.The ideal physical implementation of the gates introduced in the next step is almost immediate.By encoding the horizontal state of polarization of a photon as | ⟩ 0 and the vertical one as | ⟩ 1 , we need only a system composed of two calcite analyzers (this system, without the phase shifter, was already considered in the introductory sequence on basic quantum theory) with a phase shifter in the extraordinary ray to design a Z logic gate, i.e. a symmetry around the horizontal axis (figure 2).
Actually, this setup can be used for implementing an infinite number of gates.As a matter of fact, by rotating a birefringent crystal around its ordinary axis, we obtain a beam separation on different couples of perpendicular directions of polarization.It follows that every gate which can be described as an axial symmetry of the state plane is realizable in this way (figure 3).In particular, if the ordinary axis is associated with a polarization angle θ = 45°, we obtain a X (i.e.NOT) gate, if θ = 22,5°, a Hadamard gate.
Next, we present students with half-wave plates, a more realistic device producing the same transformation which can also be interpreted as an axial symmetry around the slow axis.
In figure 4 we summarize the quantum logic gates used in the sequence, with the corresponding representation provided to students in terms of axial symmetries in polarization space.
Polarization measurements are performed by using an additional tool, that is already available to students since the beginning of the introductory unit on QM: the calcite crystal, followed by two photodetectors.
After this sequence, students have all they need to implement logic circuits with one polarization-encoded qubit.For maximizing educational effectiveness, we introduce a color code (figure 5) to identify visual elements pertaining to the polarization encoding, which are represented in red.For instance, half-wave plates are red rectangles with the caption ' / l 2' and the angle of the slow axis (i.e. the symmetry axis which identifies the logic gate).The result is the possibility to translate a logical scheme to an optical-bench scheme as exemplified in figure 5. Students are asked to analyze and represent other circuits by using the same visual code both in the classroom and for homework.

Spatial mode encoding of qubits
The basic device we need to prepare a qubit and act as logic gate in a spatial mode encoding is a non-polarizing beam splitter, which we present in an idealized simple form.We limit ourselves to describe the construction of a cubic beam splitter made from two triangular glass  prisms (index of refraction n) with an interposed layer of semitransparent dielectric material and glued together with a special cement also semitransparent.The refraction index of the cement is n 1 <n, and the refraction index of the dielectric is n 2 > n.The laws of classical optics prescribe a phase shift of p for the reflection of beams that travel from glass onto the  dielectric layer.Instead, the reflection of beams traveling from glass onto the cement layer does not produce a phase shift. 5The encoding of the paths may be performed so that those two corresponding to a reflection without phase shift are labeled as 0 and the other two as 1.The beam splitter can be rotated to invert the position of the two prisms and, as a result, the encoding of the paths (figure 6).This flexibility will allow us to implement various logic circuits with generalized Mach-Zehnder setups without resorting to waveguides, only by choosing the orientation of the beam splitters.
The analysis of the action of a beam splitter on a classical light beam starts with a 50:50 device (half of the light is transmitted, half reflected).Since we are interested only in the fraction of amplitude of the two outgoing beams and in their relative phases, we simplify the expression of the field vector in a similar way as in the previous unit and label the versor of Note that our coding of spatial mode qubits is different from the one adopted for example in [18], in which the values 0 and 1 are attached to the direction of motion (vertical or horizontal, in our representation) of the photon or beam, and therefore the joint action of a pair of mirrors on the two sides of the interferometer, as in the Mach-Zehnder setup, is equivalent, apart from a phase factor, to the one of a NOT gate.In our case, we preferred to maintain the identification of quantum states as different possible classical paths, and the compatibility with the analysis of the Mach-Zehnder performed in [19].Therefore, in our coding of the spatial mode in the Mach-Zehnder case, the values 0 and 1 are attached respectively to the photon or beam lying in the 'lower' or 'upper' arm of the interferometer (see, as identified for example by drawing a diagonal line passing through the two beam splitters).Therefore, in our case the joint action of a pair of mirrors in the two branches is instead trivial, being it represented by an overall phase factor, which in any case we ignore, although its presence in principle is explained to students (we consider e.g.mirrors followed by a p phase shifter).
In the context of spatial mode encoding, the construction of the qubit is not as immediate as in the case of polarization.As a matter of fact, identifying physical properties that can correspond to the states | ⟩ 0 and | ⟩ 1 is a necessary but not sufficient condition to encode information in a qubit.We must be capable of preparing arbitrary superpositions of the basis states on which devices implementing logic gates can act.The key to the solution is preparing quantum states by means of a custom-designed beam splitter, with transmission and reflection coefficients chosen in accordance with the goals of the designer.In this case, the sign of the superposition can be established in two ways: either by choosing the ingoing path (0 or 1), or by placing a phase shifter in one outgoing path.
The implementation of the Hadamard gate on a single photon, on the other hand, is straightforward: it is in fact represented by a 50:50 beam splitter.Other gates may be conceptually more sophisticated, but will not be used for the Deutsch algorithm.
A circuit formed by two H gates and a measurement device corresponds to the basic setup of a Mach-Zehnder interferometer (figure 7): a source of single photons (omitted in the figure), two 50:50 beam splitters, two mirrors with no phase shift and photon counters.As for polarization, students are asked to represent the implementation of single qubit circuits in a spatial mode encoding.One of these is the basic Mach-Zehnder interferometer setup.

Two-qubit gates
For the introduction of two-qubit gates, we rely on the conceptual description of spatial and polarization modes of a photon and of their entanglement, and on their mathematical representation in terms of product states, which has been discussed in the unit on QM.The implementation of non-entangling gates on spatial modes and polarization-encoded qubits is quite straightforward (see figure 8, on the left, for a two-qubit H gate). Entangling gates, such as CX (controlled NOT), may be more or less easy to implement, depending on which encoding is used for the control and which for the target.Note that the representation of the CX gate (figure 8, right) should not be confused with a superficially similar circuital 1 spatial state, realizing a CNOT gate.

The Deutsch algorithm
The Deutsch algorithm is presented starting from the definition of a procedure to determine whether a coin is genuine or defective (or counterfeit).More precisely, a coin is defined as genuine if it has two different impressions (Heads and Tails) on the two sides, and as defective otherwise.The teacher supports the discussion by explaining that the procedure should be thought as follows: I observe the first side and note the image; I turn the coin over and note the image; if they are different, the coin is genuine; otherwise, it is defective.After doing so, the teacher introduces a similar problem, shifting the focus from the coin object to a database containing information about coins.The statement of the problem is as follows: 'A mint has a machine that produces coins, with one silver (A-side) and one gold (B-side) 6 face and engraves on each face an impression that can be a head (H) or tails (T).For each coin, the control software of the machine stores a binary number identifying the coin, and a pair of letters whose first element expresses the image printed on side A, the second on side B. If a coin is correctly made, the machine stores a pair of the type (H,T) or (T,H) at the output; if, on the other hand, there has been some manufacturing defect, a pair of the type (H,H) or (T,T) is stored.The mint needs to eliminate defective coins and asks a programmer to create an algorithm that interrogates the available database to recognize the defective coins that can then be eliminated.' When translated into the language of Boolean function, the solution to this problem in classical computation is simply a XOR gate.But clearly, the problem can also be seen as the issue to determine whether the function f associating each side of a coin to its impression- value is constant or balanced, i.e. the problem solved by the Deutsch algorithm.Students are gradually guided to its construction by means of worksheets (see supplemental material) .In these worksheets, the main elements for a progressive building of understanding of quantum algorithms are represented by the three processes included in their information processing phase (the enablement of parallelism, the exploiting of the multiplicative structure, and the activation of interference).Finally, the worksheet also guides students in the transition from the logic diagram of the Deutsch algorithm (figure 1) to its optical implementation (figure 9).More specifically, figure 9 shows the scheme for the implementation of the Deutsch algorithm with one spatial mode and one polarization-encoded qubit.

Experimental realization with classical light
The latest version of the course tested includes a three-hour session in the laboratory.Students perform experiments addressed in the lectures (including for example an experimental test of Malus's law and of the behavior of a beam splitter with laser light) and are then introduced to the 'analogue' of the Deutsch algorithm by working with classical coherent light from a laser (figure 10).This is possible thanks to the mathematical correspondence between the classical description of polarization and which path information and the quantum description of the same aspects for a single photon [23].Since the educational path is an introduction to quantum computing, students are guided to interpret different intensities measured by the detectors in terms of probability of a photon to be collected by one or the other detector.However, they are also warned that the idea of building analogues of quantum algorithms and protocols with classical light becomes increasingly unpractical for higher numbers of qubits, due to the necessity of exponential scaling of resources [23].
The outcome of the experiment for the same configuration of the oracle depicted in figure 10 is shown in figure 11.As can be seen, the result is convincing enough but not perfect: the light intensity in Camera 2, which corresponds to the leftmost detector in figure 10, is much lower than in Camera 1 but not zero.This is due mostly to beam splitter non-ideality, especially to the fact that reflection and transmission coefficients are not independent of the input polarization state as in the ideal case.However, the output can be easily transformed into the expected dichotomous result by setting a threshold on the detectors' outputs.The simplest way is to set the threshold to the mean value between the low and high intensity values, assigning zero and one to the lowest and highest values, respectively.

Results
Our research on teaching-learning quantum computation and information topics in secondary school proceeded gradually by running, in parallel, courses for teacher professional development (see for example [24]) and experimentations with students.The latter included both trials held in students' classroom, and in out-of-school settings such as a vocational summer school for students bound to start the final year of secondary school, which was held at our department in Summer 2022.Some of the experimentations, especially those run by teachers formed in our courses, were partial and only touched some selected topics.Here we discuss some of the data from two experimentations, both involving an active role of the researchers.The first one was conducted with 16 students of a final year of secondary school (18-19 years old) in spring 2022; the classroom teacher was the main instructor while one researcher was present and acted as supporting tutor and aid.The second one, held in summer 2022, involved 14 self-selected students bound to start the final year of secondary school (17-18 years old) and was directly guided by the researchers.Both groups come from science-intensive schools, whose curriculum includes 2-3 h of physics and 4-5 h of mathematics per week, starting from grade 9.Among the vast amount of data available for these two trials, we choose to examine the worksheet on the Deutsch algorithm, which was filled in by students during the course, and is available as supplemental material.The raw data set for this study is available online [24].When comparing the two samples, it should be taken into account that, while the summer school sample is self-selected for interest in physics, it is also on average one year younger than the curricular one, and had a steeper learning curve in the first part of the sequence, due to starting with no background on electromagnetism or light polarization, which was instead available to the curricular sample.Another difference between the two samples is the three hours of experimental work described in section 4 were performed only by the summer school sample.

Questions related to quantum parallelism
The first group of questions (A1-A3) serves to introduce the concept of quantum parallelism, starting with the single qubit case.Students need to understand that the Hadamard gate allows us to encode both basis states in a single qubit by means of superposition, and then that a gate can act in parallel over both such basis states thanks to its linearity property.In the curricular sample, 15 students answered correctly that information on both sides is encoded in the output states, and 7 made explicit reference to quantum superposition.However, a possible confusion/identification between the coefficients of a superposition and probability outcomes appears, since 7 students only refer to the fact that a measurement would give the two outcomes with equal probability.In the summer school sample, 13 out of 14 students answered correctly, and again 7 referred explicitly to the state being one of superposition, the others mentioned probability of outcomes.
Question A2: Discuss whether there is an advantage with respect to the classical case related to the use of the H gate.If so, in what does it consist?If not, why?
In the curricular sample, 10 out of 26 students answered as expected that there is an advantage in the quantum coding and some of them related it to the enabling of parallelism.However, the problem highlighted for the previous question re-emerged as three students answered that there is no advantage since there is 50% of probability of obtaining either outcome.In the summer school sample, 11 out of 14 students answered correctly, and the incorrect answers displayed different patterns: two were blank, one mentioned probabilities of outcomes, and one probably misunderstood the question.
Question A3: What property of the operators ensures that the quantum advantage of being able to act simultaneously on both elements of the computational basis can actually be exploited?Justify your answer.
For the curricular sample, we have not analysed the answers to this item since the teacher mistakenly anticipated the answer it during the explanation.In the summer school sample, 11 out of 14 students correctly answered appealing to linearity of operators.The second group of questions (B1-B4) is related to what is, and what is not, the role of the oracle in the Deutsch algorithm.Students must recognize the action of the operator U as CNOT in the particular case examined (B1) and understand the role of the (tensor) product structure of compound quantum systems, which allows the transfer of information on the image of the binary function from the ancilla to the target in terms of a plus or minus sign (B2).They again are led to recognize quantum parallelism, this time at the output of the oracle (B3) but also to reflect on the fact that parallelism, alone, is not sufficient to produce the quantum advantage (B4).One crucial element is still missing to retrieve information encoded in the sign: interference.
Question B1: The operator U is a logic gate with two inputs and two outputs.Write down the truth table (the behaviour of the operator on |00〉, |01〉, |10〉, |11〉) of the logic gate in the case f(0) = 0 ∧ f(1) = 1.Are there any logic gates of your knowledge that operate in this way?If so, please specify which ones.If not, explain why.
In the curricular sample, 13/16 students completed the table correctly and 11/16 recognized the CNOT gate which had previously been discussed during the course.In the summer school sample, 13/14 students correctly filled the truth table, and 7/14 identified the CNOT gate.
Question B2: The minus sign can be transferred from the ancilla to the target.What feature of quantum physical systems is exploited?
In the curricular sample, only four students recognized the role of the (tensor) product structure of compound quantum systems, while nine of them erroneously referred to properties of a superposition.On the other hand, in the summer school sample 10/14 students correctly identified the crucial property in the product structure of quantum compound state.
The following two questions, which are clearly connected, were given together to students and the sequence did not proceed until they answered both of them: Question B3: Which impression(s) on the side of the coin does the output state of the target qubit from the oracle carry information on?
In the curricular sample, 11/16 students correctly answered that the output state carries information on both impressions (heads and tails), and some of them mentioned superposition as a reason, although an explanation was not required for this item.In the summer school sample, 12/14 students answered correctly.
Question B4: If we implemented the circuit a large number of times in the same initial condition and measured the target on the computational basis, could we know whether the coin was genuine or counterfeit?
In the curricular sample, 7/16 students answered correctly and explained by stating that the presence and position of any minus sign in the state cannot be discerned in the measurement described.In the summer school sample 10/14 students provided a correct answer with similar explanations.The third group of questions (C1-C3) concerns the role of the last Hadamard gate in producing interference between the components of the state at the output of the oracle, thus completing the computation.Students are required to understand the action of the Hadamard on the state of the first register resulting from all possible oracle settings, retrieving information encoded in the sign of the superposition (C1), to connect the goal of the algorithm to the measurement outcome (C2) and finally, to precisely quantify the quantum advantage in this very simple example.
Question C1: Knowing that the final state of the first register before the last Hadamard is complete the following table

State after last Hadamard
Classical bit after measurement and probability Most students correctly completed the table both in the curricular sample (13/16) and in the summer school sample (9/14).Some of the incorrect answers contained one or two sign mistakes.
Question C2: By observing the table above, establish whether there is a relationship between the authenticity of the coin and the outcome of the measurement.Explain Again most students correctly identified the link between measurement outcomes and the result of the problem, both in the curricular sample (12/16) and the summer school sample (9/14).However in some cases we still observe difficulties in distinguishing between the state and the measurement outcome, like in the following statement by a student of the curricular sample: 'Every time we measure ±|1〉 out, we find a genuine coin' Question C3: How many times does the quantum operator U f have to be implemented in order to determine whether a coin among those in the database is genuine or defective?What is the advantage over classical computation?
In the curricular experimentation, 12 students answered correctly to this item, while 11 correct answers were given in the summer school sample.

Questions related to the optical realization
The last part of the sheet, concerning the connection between the logic diagram of the Deutsch algorithm and its optical realization, was only performed in the summer school for time reasons.The questions require students to connect the representation of the Deutsch algorithm in terms of logic gates to its realization with optical devices, and to identify the functional role of each device (D1) and to describe in formal terms the evolution of the state within the optical circuit (D2) using the Dirac notation.The exact statements of the two questions D1 and D2 can be found in the supplemental material, and since they include two figures already present in this paper (figures 1 and 9) they are not replicated here.Half the students of the summer school sample (7 out of 14) were able to describe the state evolution along the optical circuit in a completely correct way, and some only got a sign wrong after the half-wave plate realizing the action of the oracle.The analysis of the correspondence between logic gates and optical elements were in most cases correct.

Conclusions
We have presented the main lines for a short (about 8 h, provided that basic elements of QM using a two-state approach have been preliminarily treated) introduction to the Deutsch algorithm suitable for advanced secondary school students.The subdivision of the operation of the quantum algorithm in three sequential processes, each connected to a property of quantum systems, seems productive in scaffolding students' learning and can potentially be transferred to the treatment of other cases, such as the Grover algorithm.Preliminary results show that the educational outcomes can be satisfying, and in general the teachers involved did not find significant differences with the outcomes of other physics topics.From the analysis of students' answers, problems remain mostly in clarifying the distinction between a superposition state and a mixture, or between the state and measurement outcomes.This is a wellknown and persistent issue in QM education [25], and while it was addressed in the initial introduction to the quantum theory, a need emerges to reinforce the understanding of quantum superposition also during the path on quantum information.Our proposal includes the design of an analogue realization of the Deutsch algorithm on the optical bench with coherent classical light which, while perhaps not within the reach of the typical high school laboratory, can be easily realized in any university-level optics lab, and as such can be useful for vocational stages and schools or outreach actions aimed at secondary students.

| ⟩ 0 and | ⟩ 1 .
The most general state of a qubit is |

j
ae i and b = d be i where a and b are real positive numbers.Then one can rewrite the most general state of a qubit as |

Figure 1 .
Figure 1.Quantum circuit of Deutsch's algorithm.Squares labelled with H represent Hadamard gates, while O f is the 'oracle' for the unknown function f (see text).The symbol ⊕ represents sum modulo 2. The square with the pointer symbol represents the measurement of the qubit value.

Figure 2 .
Figure 2. Idealized design of a Z gate on a polarization-encoded qubit.

Figure 3 .
Figure 3. Generic gate describable as an axial symmetry on the state plane.

Figure 4 .
Figure 4.Quantum logic gates used in the sequence.For each gate, we give the graphical representation of the transformation realized in polarization space, with the angle of the symmetry axis α; the corresponding truth table and circuit representation.

Figure 5 .
Figure 5. Above: an example of simple logic circuit proposed to students.Below: ideal realization of the circuit on an optical bench.

Figure 6 .
Figure 6.Analogy between classical and quantum descriptions of a beam splitter.(a) Classical description as presented to students.The versors 0 and 1 can be seen as labeling different field directions, orthogonal to the direction of wave propagation.(b)Quantum description in terms of photon numbers at the two inputs and outputs (not presented to students).(c) Simplified quantum description in which state labels refer to different possible paths available to one photon.For identifying visual elements pertaining to the spatial mode coding, we represent them in blue.In the representation of the beam splitter, the dielectric layer is represented by a solid line, while the cement layer is represented by a blurred line.

Figure 7 .
Figure 7.Above.An example of logic circuit.Below: its ideal implementation using spatial mode encoding.

Figure 8 .
Figure 8. Ideal scheme for the implementation of a two-qubit H gate (left) and a CX gate (right) with one spatial mode and one polarization-encoded qubit.

Figure 9 .
Figure 9. Ideal scheme for the implementation of Deutsch's algorithm using spatial mode and polarization encoding.In our visual code, elements pertaining to both encodings are represented in violet.

Figure 10 .
Figure 10.Experimental apparatus for the optical implementation of the Deutsch algorithm with classical light.In the labels of the figure, HWP stands for 'half-wave plate', BS for 'beam splitter'.The correspondence with the ideal scheme depicted in figure 9 is evident, except for the gray filter which has only the role of attenuating the light intensity.In order to reproduce the different outcomes of the Deutsch algorithm, the half-wave plate HWP0 is always rotated at 22.5°with respect to horizontal, while HWP1 and HWP2 are either rotated −45°with respect to horizontal, to produce a null effect on the | ⟩ ¢ 1 polarization state at the input, or at +45°to produce an X gate.The presence of both half-wave plates HWP1 and HWP2 in all cases in the optical device, instead of them being present or absent depending on the oracle setting, of is the only difference with the diagram of figure 9, and is due to the necessity of maximizing the coherence of light in the two branches of the interferometer.

Figure 11 .
Figure 11.Outcomes at the two detectors (cameras).Camera 1, on the left, should display the analogue of a logical 1, while camera 2, on the right, should display the analogue of a logical 0.

Question A1 :
In relation to the coin problem: which side(s) of the coin is/are encoded in the output state of the first Hadamard?(Remember that according to the database encoding silver face = 0; gold face = 1).

4. 2 .
Questions related to the oracle and the role of product states

4. 3 .
Questions related to the enabling of interference and final conclusions

Table 1 .
Truth table for the sum modulo 2 operation.Since no carry bit is considered, the table is equivalent to the one for the XOR gate.