Implementaton of Deutsch's Algorthm Usng Mathcad Frank Roux The followng s a Mathcad mplementaton of Davd Deutsch's quantum computer prototype as presented on pages - n "Machnes, Logc and Quantum Physcs" by Davd Deutsch, Artur Ekert, and Rossella Lupacchn, whch can be found at arxv:math.ho/995v. A functon f maps {, } to {, }. There are four possble outcomes: f() = ; f() = ; f() = ; f() =. The task Deutsch tackled was to develop an mplementable quantum algorthm whch could determne whether f() and f() were the same or dfferent n a sngle calculaton. By comparson classcal computers requre two calculatons for such a task - calculatng both f() and f() to see f they are the same or dfferent. The proposed quantum computer conssts of three one-qubt gates n the arrangement shown below. The not gates are 5-5 beam spltters that assgn a / (, 9 degree) phase change to reflecton relatve to transmsson. For example, the frst gate creates the followng superpostons of the nputs > and >. The mddle gate carres out phase shfts on the superposton created by the frst gate. Dependng on the f-values, the operaton of the second not converts the superposton to ether > or > multpled by a phase factor or unty. The Deutsch crcut s essentally a two-port Mach-Zehnder nterferometer wth the possblty for unequal phase changes n ts upper and lower arms. The matrx representatons for the gates are as follows: = = f f = = We begn wth a matrx mechancs approach to Deutsch's algorthm usng the defntons provded mmedately above. There are two nput ports and two output ports, but only one nput port s used n any gven computatonal run. Frst t s shown how the output result depends on the nput port chosen n terms of the values of f() and f().
Input f f f f f f Input f f f f f f These calculatons and the crcut dagram show that there are two paths to each output port from each nput port. As wll now be shown these paths nterfere constructvely or destructvely dependng on the phase changes brought about by the mddle crcut element's values of f() and f(). The followng calculatons show that the probablty that > nput leads to > output s zero f f() and f() are the same (both or both ), and unty f they are dfferent (one, the other ). Thus the task has been successfully accomplshed. The hghlghted central regon calculates the output state for nput state > gven the values of f() and f() to the left. On the rght the probablty that > s the output state s calculated. f f f f f f f f f f f f f f f f As mght be expected, smlar calculatons show that the probablty that > nput leads to > output s zero f f() and f() are the same, and unty f they are dfferent. f f f f
f f f f ( ) f f f f ( ) f f f f ( ) Examnaton of the Deutsch crcut reveals certan smlartes wth the double-slt experment. For example, there are two paths for nput > to output > and nput > to output > (and also for > --> > and > --> >, but they are not of nterest here). As Deutsch and hs co-authors state, ths s the secret of the quantum computer - the possblty of constructve and destructve nterference of the probablty ampltudes for the varous computatonal paths. Addton of probablty ampltudes, rather than probabltes, s one of the fundamental rules for predcton n quantum mechancs and apples to all physcal objects, n partcular quantum computng machnes. If a computng machne starts n a specfc ntal confguraton (nput) then the probablty that after ts evoluton va a sequence of ntermedate confguratons t ends up n a specfc fnal confguraton (output) s the squared modulus of the sum of all the probablty ampltudes of the computatonal paths that connect the nput wth the output. The ampltudes are complex numbers and may cancel each other, whch s referred to as destructve nterference, or enhance each other, referred to as constructve nterference. The basc dea of quantum computaton s to use quantum nterference to amplfy the correct outcomes and to suppress the ncorrect outcomes of computatons. Recall from above (see the matrx representng the not beam spltters) that the probablty ampltude for transmsson at the beam spltters s, and the probablty ampltude for reflecton s. The mddle element of the crcut causes phase shfts on ts nput wres that depend on the values of f() and f(). From the crcut dagram we see that > output from > nput can be acheved by two transmssons and a phase shft on the upper wre or reflecton to the lower wre, phase shft, followed by reflecton to the upper wre. The absolute magntude squared of the sum of these probablty ampltudes s calculated for the four possble values for f() and f(). f f f f f f
f f f f f f f f As expected we see consstency wth the prevous calculatons. However, ths method has the advantage of more drectly revealng what s happenng from the quantum mechancal perspectve. When f() and f() are the same the two path ampltudes nterfere destructvely; when they are dfferent there s constructve nterference between the path ampltudes. As can be seen from above, n the absence of the mddle element of the quantum crcut, the two paths from > to > are 8 degrees out of phase and therefore destructvely nterfere. In the presence of the mddle element the paths are stll 8 degrees out of phase unless the f-values are dfferent, and then they are brought nto phase and constructvely nterfere. As Feynman emphaszed n hs eponymous lecture seres on physcs, the creaton of superpostons and the nterference of probablty ampltudes are the essence of quantum mechancs. Another mplementaton of Deutsch's algorthm s due to Artur Ekert and co-workers (see Julan Brown's The Quest for the Quantum Computer, pages 353-355). The followng table provdes a summary of the results. If qubt s > f() and f() are the same, but f t s > they are dfferent. f f qubt qubt OutputState.77.77.77.77.77.77.77.77.77.77.77.77.77.77.77.77
The algorthm s mplemented below. Identty: I Not gate: NOT Hadamard gate: H f f kronecker( H I) kronecker f f NOT kronecker( H I).77.77 f f kronecker( H I) kronecker f f NOT kronecker( H I).77.77 f f kronecker( H I) kronecker f f NOT kronecker( H I).77.77 f f kronecker( H I) kronecker f f NOT kronecker( H I).77.77 It s easy to show that the output of each of these calculatons s the tensor product of qubts and n the summary table provded above. Perhaps a better way to set up ths crcut s to begn wth > and have Hadamard gates operate on both wres.
f f kronecker( H I) kronecker f f NOT kronecker( H H).77.77 f f kronecker( H I) kronecker f f NOT kronecker( H H).77.77 f f kronecker( H I) kronecker f f NOT kronecker( H H).77.77 f f kronecker( H I) kronecker f f NOT kronecker( H H).77.77 As the followng table shows, the same result s acheved as n the prevous crcut. f f qubt qubt OutputState.77.77.77.77.77.77.77.77.77.77.77.77.77.77.77.77