{"id":36396,"date":"2019-04-18T00:45:58","date_gmt":"2019-04-18T07:45:58","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/premier-developer\/?p=36396"},"modified":"2019-04-10T06:56:13","modified_gmt":"2019-04-10T13:56:13","slug":"quantum-computing-for-software-developers-part-i","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/quantum-computing-for-software-developers-part-i\/","title":{"rendered":"Quantum Computing for Software Developers \u2013 Part I"},"content":{"rendered":"<p>App Dev Manager\u00a0<a href=\"https:\/\/www.linkedin.com\/in\/leonardwoody\/\">Leonard Woody<\/a> breaks down the fundamentals of quantum computing from the perspective of a software developer.<\/p>\n<hr \/>\n<p>The underpinnings of quantum computing (QC) is quantum mechanics. Unfortunately, quantum mechanics is very weird and hard to understand. Most articles on QC are of the pop science variety and introductions to QC are usually heavy on mathematics (linear algebra). I want to do something different. I want to explain QC using the language of software development.<\/p>\n<p>So let\u2019s get started! We are all familiar with the classical binary digit or bit.<\/p>\n<p><img decoding=\"async\" width=\"480\" height=\"640\" class=\"wp-image-36397\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/https-upload-wikimedia-org-wikipedia-commons-8-8.jpeg\" alt=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/8\/80\/On-Off_Switch.jpg\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/https-upload-wikimedia-org-wikipedia-commons-8-8.jpeg 480w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/https-upload-wikimedia-org-wikipedia-commons-8-8-225x300.jpeg 225w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/p>\n<p>The analog to this in QC is the quantum bit or qubit. An electron\u2019s spin can be used to physically represent this.<\/p>\n<p><img decoding=\"async\" width=\"910\" height=\"775\" class=\"wp-image-36398\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-43.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-43.png 910w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-43-300x255.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-43-768x654.png 768w\" sizes=\"(max-width: 910px) 100vw, 910px\" \/><\/p>\n<p>Now, let\u2019s code all this up (I\u2019m using pseudo-code throughout the article).<\/p>\n<p><img decoding=\"async\" width=\"486\" height=\"207\" class=\"wp-image-36399\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-44.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-44.png 486w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-44-300x128.png 300w\" sizes=\"(max-width: 486px) 100vw, 486px\" \/> <img decoding=\"async\" width=\"550\" height=\"291\" class=\"wp-image-36400\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-45.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-45.png 550w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-45-300x159.png 300w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/p>\n<h2>Superposition<\/h2>\n<p>The first major concept to understand in QC is superposition. I think it\u2019s a horrible term in terms of describing what it actually is, but hey I\u2019m not Richard Feynman. Superposition means that a qubit can be in the Zero state, the One state, <strong><em>or<\/em><\/strong> a combination of the Zero and One states.<\/p>\n<p><img decoding=\"async\" width=\"1137\" height=\"710\" class=\"wp-image-36401\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-46.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-46.png 1137w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-46-300x187.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-46-768x480.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-46-1024x639.png 1024w\" sizes=\"(max-width: 1137px) 100vw, 1137px\" \/><\/p>\n<p>Think of it as a spinning coin, in which you can\u2019t determine if it\u2019s a 0 (tails) or 1 (heads).<\/p>\n<p><img decoding=\"async\" width=\"308\" height=\"401\" class=\"wp-image-36402\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-47.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-47.png 308w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-47-230x300.png 230w\" sizes=\"(max-width: 308px) 100vw, 308px\" \/> <img decoding=\"async\" width=\"303\" height=\"401\" class=\"wp-image-36403\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-48.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-48.png 303w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-48-227x300.png 227w\" sizes=\"(max-width: 303px) 100vw, 303px\" \/><\/p>\n<p><a href=\"https:\/\/youtu.be\/PX64Ltc1uXU\">https:\/\/youtu.be\/PX64Ltc1uXU<\/a><\/p>\n<p>Now, let\u2019s do it in code!<\/p>\n<p><img decoding=\"async\" width=\"2056\" height=\"543\" class=\"wp-image-36404\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-49.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-49.png 2056w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-49-300x79.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-49-768x203.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-49-1024x270.png 1024w\" sizes=\"(max-width: 2056px) 100vw, 2056px\" \/><\/p>\n<p>Pretty weird, huh! In classical computing, the last statement would equal \u201cb\u201d. But in QC, it creates a whole new state or \u201cnumber\u201d.<\/p>\n<h2>Measurement<\/h2>\n<p>So the total possible states that a qubit can be in is infinite. But, when it is measured or \u201cobserved\u201d it will always come out as 0 or 1. In code, it looks like this.<\/p>\n<p><img decoding=\"async\" width=\"839\" height=\"613\" class=\"wp-image-36405\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-50.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-50.png 839w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-50-300x219.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-50-768x561.png 768w\" sizes=\"(max-width: 839px) 100vw, 839px\" \/> <img decoding=\"async\" width=\"520\" height=\"518\" class=\"wp-image-36406\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-51.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-51.png 520w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-51-150x150.png 150w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-51-300x300.png 300w\" sizes=\"(max-width: 520px) 100vw, 520px\" \/><\/p>\n<p>So now the question is, if the qubit is in some random state (a combination of the zero and one states), how do we know what the measurement will be? The code below shows the question better.<\/p>\n<p><img decoding=\"async\" width=\"1843\" height=\"428\" class=\"wp-image-36407\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-52.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-52.png 1843w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-52-300x70.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-52-768x178.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/04\/word-image-52-1024x238.png 1024w\" sizes=\"(max-width: 1843px) 100vw, 1843px\" \/><\/p>\n<p>Well, the answer is another weird postulate of quantum mechanics. It is based on probability. Depending on the state the qubit is in, it could have a 50\/50 chance of being a 0 or a 1. Or it could be 70\/30. Whatever the probabilities are, they must add up to 100.<\/p>\n<p>In part 2 of this blog series, I\u2019ll go into how these probabilities are derived. Hope you enjoy the post!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The underpinnings of quantum computing (QC) is quantum mechanics. Unfortunately, quantum mechanics is very weird and hard to understand. Most articles on QC are of the pop science variety and introductions to QC are usually heavy on mathematics (linear algebra). I want to do something different. I want to explain QC using the language of software development.<\/p>\n","protected":false},"author":582,"featured_media":36408,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5158],"tags":[5177,3],"class_list":["post-36396","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-quantum-computing","tag-quantum-computing","tag-team"],"acf":[],"blog_post_summary":"<p>The underpinnings of quantum computing (QC) is quantum mechanics. Unfortunately, quantum mechanics is very weird and hard to understand. Most articles on QC are of the pop science variety and introductions to QC are usually heavy on mathematics (linear algebra). I want to do something different. I want to explain QC using the language of software development.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/36396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=36396"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/36396\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/36408"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=36396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=36396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=36396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}