QUANTUMALGORITHMSVIALINEARALGEBRA QUANTUMALGORITHMSVIALINEARALGEBRA APrimer RichardJ.Lipton KennethW.Regan TheMITPress Cambridge,Massachusetts London,England (cid:2)c 2014MassachusettsInstituteofTechnology Allrightsreserved.Nopartofthisbookmaybereproducedinanyformorbyanyelectronic ormechanicalmeans(includingphotocopying,recording,orinformationstorageandretrieval) withoutpermissioninwritingfromthepublisher. MITPressbooksmaybepurchasedatspecialquantitydiscountsforbusinessorsalespromotional use.Forinformation,[email protected]. ThisbookwassetinTimesRomanandMathtimePro2bytheauthors,andwasprintedandbound intheUnitedStatesofAmerica. LibraryofCongressCataloging-in-PublicationData Lipton,RichardJ.,1946– Quantumalgorithmsvialinearalgebra:aprimer/RichardJ.LiptonandKennethW.Regan. p.cm. Includesbibliographicalreferencesandindex. ISBN978-0-262-02839-4(hardcover:alk.paper) 1.Quantumcomputers.2.Computeralgorithms.3.Algebra,Linear.I.Regan,KennethW.,1959– II.Title QA76.889.L572014 005.1–dc23 2014016946 10987654321 Wededicatethisbooktoallthosewhohelpedcreateandnourishthebeautiful areaofquantumalgorithms,andtoourfamilieswhohelpedcreateand nourishus. RJLandKWR Contents Preface xi Acknowledgements xiii 1 Introduction 1 1.1 TheModel 2 1.2 TheSpaceandtheStates 3 1.3 TheOperations 5 1.4 WhereIstheInput? 6 1.5 WhatExactlyIstheOutput? 7 1.6 SummaryandNotes 8 2 NumbersandStrings 9 2.1 AsymptoticNotation 11 2.2 Problems 12 2.3 SummaryandNotes 13 3 BasicLinearAlgebra 15 3.1 HilbertSpaces 16 3.2 ProductsandTensorProducts 16 3.3 Matrices 17 3.4 ComplexSpacesandInnerProducts 19 3.5 Matrices,Graphs,andSumsOverPaths 20 3.6 Problems 23 3.7 SummaryandNotes 26 4 BooleanFunctions,QuantumBits,andFeasibility 27 4.1 FeasibleBooleanFunctions 28 4.2 AnExample 30 4.3 QuantumRepresentationofBooleanArguments 33 4.4 QuantumFeasibility 35 4.5 Problems 38 4.6 SummaryandNotes 40 5 SpecialMatrices 41 5.1 HadamardMatrices 41 5.2 FourierMatrices 42 5.3 ReversibleComputationandPermutationMatrices 43 5.4 FeasibleDiagonalMatrices 44 5.5 Reflections 45 5.6 Problems 46 viii Contents 5.7 SummaryandNotes 49 6 Tricks 51 6.1 StartVectors 51 6.2 ControllingandCopyingBaseStates 52 6.3 TheCopy-UncomputeTrick 54 6.4 SuperpositionTricks 55 6.5 FlippingaSwitch 56 6.6 MeasurementTricks 58 6.7 PartialTransforms 59 6.8 Problems 60 6.9 SummaryandNotes 62 7 Phil’sAlgorithm 63 7.1 TheAlgorithm 63 7.2 TheAnalysis 63 7.3 AnExample 64 7.4 ATwo-QubitExample 64 7.5 PhilMeasuresUp 66 7.6 QuantumMazesversusCircuitsversusMatrices 69 7.7 Problems 71 7.8 SummaryandNotes 74 8 Deutsch’sAlgorithm 77 8.1 TheAlgorithm 77 8.2 TheAnalysis 78 8.3 SuperdenseCodingandTeleportation 82 8.4 Problems 86 8.5 SummaryandNotes 87 9 TheDeutsch-JozsaAlgorithm 89 9.1 TheAlgorithm 89 9.2 TheAnalysis 90 9.3 Problems 92 9.4 SummaryandNotes 92 10 Simon’sAlgorithm 93 10.1 TheAlgorithm 93 10.2 TheAnalysis 94 Contents ix 10.3 Problems 95 10.4 SummaryandNotes 96 11 Shor’sAlgorithm 97 11.1 Strategy 97 11.2 GoodNumbers 98 11.3 QuantumPartoftheAlgorithm 99 11.4 AnalysisoftheQuantumPart 100 11.5 ProbabilityofaGoodNumber 102 11.6 UsingaGoodNumber 105 11.7 ContinuedFractions 106 11.8 Problems 107 11.9 SummaryandNotes 108 12 FactoringIntegers 109 12.1 SomeBasicNumberTheory 109 12.2 PeriodsGivetheOrder 110 12.3 Factoring 110 12.4 Problems 112 12.5 SummaryandNotes 113 13 Grover’sAlgorithm 115 13.1 TwoVectors 115 13.2 TheAlgorithm 117 13.3 TheAnalysis 117 13.4 TheGeneralCase,withkUnknown 118 13.5 GroverApproximateCounting 119 13.5.1 TheAlgorithm 122 13.5.2 TheAnalysis 122 13.6 Problems 126 13.7 SummaryandNotes 128 14 QuantumWalks 129 14.1 ClassicalRandomWalks 129 14.2 RandomWalksandMatrices 130 14.3 AnEncodingNicety 132 14.4 DefiningQuantumWalks 133 14.5 InterferenceandDiffusion 134