<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@vertical+block@Fault-tolerant_NAND_gate" data-init="VerticalStudentView" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="vertical" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<h2 class="hd hd-2 unit-title">Fault-tolerant NAND gate</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk5-ft-nand">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk5-ft-nand" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="problem" data-has-score="True" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_s12-wk5-ft-nand" class="problems-wrapper" role="group"
aria-labelledby="s12-wk5-ft-nand-problem-title"
data-problem-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk5-ft-nand" data-url="/courses/course-v1:MITx+8.371.2x+2T2018/xblock/block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk5-ft-nand/handler/xmodule_handler"
data-problem-score="0"
data-problem-total-possible="1"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="s12-wk5-ft-nand-problem-title" aria-describedby="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk5-ft-nand-problem-progress" tabindex="-1">
Fault-tolerant NAND gate
</h3>
<div class="problem-progress" id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk5-ft-nand-problem-progress"></div>
<div class="problem">
<div>
<p>
Suppose we wish to construct a reliable NAND gate, using only unreliable NAND gates (and wires &#8211; we'll assume the wires are reliable). </p>
<p>
Here is a circuit constructed from unreliable NAND gates: </p>
<p>
<center>
<img src="/assets/courseware/v1/63d5f3c578a0884de535184dd0caaeb7/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/images_ps5-maj-gate.png" width="600"/>
</center>
</p>
<p>
It turns out that the output can be expressed entirely in terms of AND and OR gates, unlike general functions which may also require NOT gates. Give a boolean function for the output [mathjaxinline]m[/mathjaxinline] in terms of the inputs [mathjaxinline]x[/mathjaxinline], [mathjaxinline]y[/mathjaxinline], and [mathjaxinline]z[/mathjaxinline]. In your answer, use <tt class="tt">*</tt> for AND, and <tt class="tt">+</tt> for OR: </p>
<p>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="inputtype_s12-wk5-ft-nand_2_1" class=" capa_inputtype textline">
<div class="unanswered ">
<input type="text" name="input_s12-wk5-ft-nand_2_1" id="input_s12-wk5-ft-nand_2_1" aria-describedby="status_s12-wk5-ft-nand_2_1" value="" size="30"/>
<span class="trailing_text" id="trailing_text_s12-wk5-ft-nand_2_1"/>
<span class="status unanswered" id="status_s12-wk5-ft-nand_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p id="answer_s12-wk5-ft-nand_2_1" class="answer"/>
</div>
</div></div>
</p>
<p>
<div class="solution-span">
<span id="solution_s12-wk5-ft-nand_solution_1"/>
</div></p>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Fault-tolerant NAND gate" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_s12-wk5-ft-nand" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_s12-wk5-ft-nand">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
<span class="problem-action-button-wrapper">
<button type="button" class="save problem-action-btn btn-default btn-small" data-value="Save">
<span class="icon fa fa-floppy-o" aria-hidden="true"></span>
<span aria-hidden="true">Save</span>
<span class="sr">Save your answer</span>
</button>
</span>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk5-ft-nand-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk5-ft-nand-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk5-ft-nand-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box019164">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box019164" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="html" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<span><a href="/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/NONE" id="dummy_course_static_link" style="display:none"/><a href="/courses/course-v1:MITx+8.371.2x+2T2018/jump_to_id/NONE" id="dummy_jump_link" style="display:none"/><script type="text/javascript">
var add_site_search = function(){
course_static_url = $('#dummy_course_static_link').attr('href').replace('/NONE', '');
jump_to_url = $('#dummy_jump_link').attr('href').replace('/NONE', '');
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
String.prototype.startsWith = function (str){
return this.indexOf(str) === 0;
};
}
if(typeof(String.prototype.trim) === "undefined")
{
String.prototype.trim = function()
{
return String(this).replace(/^\s+|\s+$/g, '');
};
}
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var amp = String.fromCharCode(38);
var rlb = rb + lb;
var mke = function(x){ return lb + x + rb; }
var search_module_url = "";
var get_search_module_ficus = function(){
var cid = $('div.xblock').data('course-id');
if (cid){
console.log("cid = ", cid);
// search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/" + cid + "/courseware/welcome/Search_this_course/";
search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/courseware/welcome/Search_this_course/"; // automatically rewritten
console.log("3. search_module_url = ", search_module_url);
return;
}
var course_root_link = $('span.nav-item-course').find('a').attr('href');
if (course_root_link){
console.log("course_root_link = ", course_root_link);
search_module_url = course_root_link.replace("course/", "courseware/welcome/Search_this_course/");
console.log("2. search_module_url = ", search_module_url);
return
}
console.log("cannot determine search module url");
}
var get_search_module = function(){
// find search this module link
if (!($('div.course-index').length)){
return get_search_module_ficus();
}
$('div.course-index').find('nav').find('a').each(function(){
if ($(this).text().trim().startsWith("Search this course")){
search_module_url = $(this).attr('href');
console.log("search_module_url = ", search_module_url);
}
});
}
var go_to_search = function(){
get_search_module();
var sterm = $('#site-search-box').val();
// new_url = jump_to_url + "/Search_this_module/?q=" + sterm;
new_url = search_module_url + "?q=" + sterm;
console.log("sterm = ", sterm, " ; going to ", new_url);
window.location.href = new_url;
}
if (!$('#site-search-box').length){
$("nav.courseware").find("ol").append(lb + "section style='float:right'" + rlb + "input size='20'"
+ " id='site-search-box'"
+ rlb + "img src='" + course_static_url
+ "/images_search_glass.png'/" + rlb + "/input" + rlb + "/section" + rb);
}
$("#site-search-box").keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
go_to_search();
}
});
// $('#site-search-box').bind("enterKey", go_to_search);
var get = function(x){
return eval(x);
}
return {'course_static_url': course_static_url,
'jump_to_url': jump_to_url,
'go_to_search': go_to_search,
'get_search_module': get_search_module,
'get_search_module_ficus': get_search_module_ficus,
'get': get,
}
}
var the_site_search = add_site_search();
var add_fix_transcript = function(){
if ($('div.wrap-instructor-info').length==0){
return;
}
$('div.xblock-student_view-video').each(function(key, vblock_e){
var vblock = $(vblock_e);
var vuid = vblock.data('usage-id').split('@');
var vid;
if (vuid.length==1){
vuid = vblock.data('usage-id').split(';_')
vid = vuid[5];
}else{
vid = vuid[2];
}
var mfnpre = vid.split("_video",1)[0];
var mfnid = mfnpre; // no periods
mfnpre = mfnpre.replace('8_370', '8.370'); // periods in gh filename
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var mke = function(x){ return lb + x + rb; }
var ftid = "fix_transcript_" + mfnid;
if (!$('#' + ftid).length){
var html = lb + "span id='" + ftid + "' style='float:right'" + rb + lb + "a href='#'" + rb;
html += "contribute transcript fix" + mke("/a") + mke("/span");
console.log("html = ", html);
vblock.after(html)
}
$('#' + ftid).click(function(){
var cst = $('ol.subtitles').find('li.current');
var cindex = Number(cst.data('index'));
var gurl;
if (mfnpre.endsWith('_cq_sol')){
gurl = "https://github.com/mitocw/content-mit-8370x-cq-sol-subtitles/blob/master/";
}else{
gurl = "https://github.com/mitocw/content-mit-8370x-subtitles/blob/master/";
}
gurl += mfnpre + ".txt#L" + String(cindex + 10 + 1);
console.log("going to ", gurl);
window.open(gurl, "MITx 8.370x subtitle source");
});
});
}
try{
add_fix_transcript();
}
catch(err){
console.log(err);
}
try{
var rb = String.fromCharCode(62);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 3000);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 8000);
}
catch(err){
console.log(err);
}
</script></span>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@vertical+block@Fault_tolerant_NAND_circuit" data-init="VerticalStudentView" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="vertical" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<h2 class="hd hd-2 unit-title">Fault tolerant NAND circuit</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@html_Fault_tolerant_NAND_circuit">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@html_Fault_tolerant_NAND_circuit" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="html" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p><big class="xxlarge">Fault tolerant NAND circuit</big></p><p>
We wish to construct a reliable NAND gate, using only unreliable NAND gates. A powerful approach for solving this problem studies the Boolean formulas implemented by the circuit, as we demonstrate in this problem. </p><ul class="itemize"><li><p>
Consider the three-input majority voting circuit [mathjaxinline]{\tt maj(a,b,c)}[/mathjaxinline]. It may be realized by a circuit of NAND gates described by this Boolean formula: </p><p>
[mathjaxinline]{\tt maj(a,b,c)} = {\tt Nand(Nand(Nand(Nand(a,b),Nand(b,c)),Nand(Nand(a,b),Nand(b,c))),Nand(a,c))}[/mathjaxinline] </p><p>
The neat thing about this gate is that it does not propagate single bit errors. This is captured by the fact that </p><p>
[mathjaxinline]{\tt maj(e,x,x) = maj(x,e,x) = maj(x,x,e) = x}[/mathjaxinline] </p><p>
as long as two of the bits are the same value [mathjaxinline]{\tt x}[/mathjaxinline], the output is independent of the remaining bit [mathjaxinline]{\tt e}[/mathjaxinline]. Similar error-ignoring behavior occurs already for the NAND gate, since [mathjaxinline]{\tt Nand(e,False)}[/mathjaxinline] is always [mathjaxinline]{\tt True}[/mathjaxinline] independent of the value of the error bit [mathjaxinline]{\tt e}[/mathjaxinline]. </p></li><li><p>
This suggests a nice way to compute the number of ways a circuit can fail. If a gate [mathjaxinline]g[/mathjaxinline] in a circuit fails, we may say that its output is replaced with some variable [mathjaxinline]{\tt e}g[/mathjaxinline]. Next, write down a boolean formula [mathjaxinline]f[/mathjaxinline] describing the circuit's output, taking this failure into consideration. If [mathjaxinline]f[/mathjaxinline] is dependent on [mathjaxinline]{\tt e}g[/mathjaxinline], this means the error has propagated and causes the output to fail. Otherwise, the error has been caught in the circuit, and does not cause an output failure. </p></li><li><p>
Consider this circuit: </p><p><center><img src="/assets/courseware/v1/c5597543a9938b57f183a8692f4e6d86/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/images_fault-tolerant-nand-circuit-v1d.png" width="800"/></center></p><p>
If we relabel the [mathjaxinline]x_ k[/mathjaxinline] block inputs as (a,b,c) and the [mathjaxinline]y_ k[/mathjaxinline] block inputs as (d,e,f), then the three outputs (call them (o1, o2, o3)) can compactly be described as being given by: </p><blockquote class="quote"> o1 = [mathjaxinline]{\tt maj(Nand(a,d),Nand(a,d),Nand(a,d))}[/mathjaxinline] <br/>o2 = [mathjaxinline]{\tt maj(Nand(b,e),Nand(b,e),Nand(b,e))}[/mathjaxinline] <br/>o3 = [mathjaxinline]{\tt maj(Nand(c,f),Nand(c,f),Nand(c,f))}[/mathjaxinline] </blockquote><p>
since the circuit partitions into three independent circuits. </p><p>
Each of the [mathjaxinline]{\tt maj}[/mathjaxinline] gates can be expanded into [mathjaxinline]{\tt Nand}[/mathjaxinline] gates, that is, using the circuit above, but keeping in mind that [mathjaxinline]{\tt Nand(a,b),Nand(b,c))}[/mathjaxinline] repeats twice, but need only be computed by a single set of gates. This circuit may also be drawn as the graph: </p><p><center><img src="/assets/courseware/v1/514220b2a75aeef369316195fbf8f776/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/images_ft-nand-v1d-graph2.png" width="750"/></center></p></li><li><p>
Define a <em>fault path</em> as a set of errors, applied to either a gate or an input, which leads to the output of the circuit being faulty. The output is faulty if it contains more than one error (for this triple-redundancy case). </p><p>
For each set of possible errors, we may write down a boolean formula for the output. For example, if [mathjaxinline]{\tt Nand9}[/mathjaxinline] and [mathjaxinline]{\tt Nand26}[/mathjaxinline] are faulty, such that their outputs are [mathjaxinline]{\tt eNand9}[/mathjaxinline] and [mathjaxinline]{\tt eNand26}[/mathjaxinline] instead of what they ideally should be, then the circuit outputs are </p><blockquote class="quote"> o1 = [mathjaxinline]{\tt eNand9}[/mathjaxinline] <br/>o2 = [mathjaxinline]{\tt Or(Not(b), Not(e))}[/mathjaxinline] <br/>o3 = [mathjaxinline]{\tt Or(Not(c), Not(eNand26), Not(f))}[/mathjaxinline] <br/></blockquote><p>
Since two of these bits depend on the values of the errors, then the output is faulty. Thus, [mathjaxinline]({\tt Nand9},{\tt Nand25})[/mathjaxinline] constitutes a fault path. </p></li><li><p>
Note that multi-input gates with errors in their inputs do not always generate outputs which have errors because of the error-ignoring properties of [mathjaxinline]{\tt Nand}[/mathjaxinline] discussed above. Error propagation must thus be considered carefully, particularly when the inputs are known to have certain properties. </p></li></ul>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk11-ftnand-min">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk11-ftnand-min" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="problem" data-has-score="True" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<p>Could not format HTML for problem. Contact course staff in the discussion forum for assistance.</p>
</div>
</div>
<div class="vert vert-2" data-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box019165">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box019165" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="html" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<span><a href="/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/NONE" id="dummy_course_static_link" style="display:none"/><a href="/courses/course-v1:MITx+8.371.2x+2T2018/jump_to_id/NONE" id="dummy_jump_link" style="display:none"/><script type="text/javascript">
var add_site_search = function(){
course_static_url = $('#dummy_course_static_link').attr('href').replace('/NONE', '');
jump_to_url = $('#dummy_jump_link').attr('href').replace('/NONE', '');
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
String.prototype.startsWith = function (str){
return this.indexOf(str) === 0;
};
}
if(typeof(String.prototype.trim) === "undefined")
{
String.prototype.trim = function()
{
return String(this).replace(/^\s+|\s+$/g, '');
};
}
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var amp = String.fromCharCode(38);
var rlb = rb + lb;
var mke = function(x){ return lb + x + rb; }
var search_module_url = "";
var get_search_module_ficus = function(){
var cid = $('div.xblock').data('course-id');
if (cid){
console.log("cid = ", cid);
// search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/" + cid + "/courseware/welcome/Search_this_course/";
search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/courseware/welcome/Search_this_course/"; // automatically rewritten
console.log("3. search_module_url = ", search_module_url);
return;
}
var course_root_link = $('span.nav-item-course').find('a').attr('href');
if (course_root_link){
console.log("course_root_link = ", course_root_link);
search_module_url = course_root_link.replace("course/", "courseware/welcome/Search_this_course/");
console.log("2. search_module_url = ", search_module_url);
return
}
console.log("cannot determine search module url");
}
var get_search_module = function(){
// find search this module link
if (!($('div.course-index').length)){
return get_search_module_ficus();
}
$('div.course-index').find('nav').find('a').each(function(){
if ($(this).text().trim().startsWith("Search this course")){
search_module_url = $(this).attr('href');
console.log("search_module_url = ", search_module_url);
}
});
}
var go_to_search = function(){
get_search_module();
var sterm = $('#site-search-box').val();
// new_url = jump_to_url + "/Search_this_module/?q=" + sterm;
new_url = search_module_url + "?q=" + sterm;
console.log("sterm = ", sterm, " ; going to ", new_url);
window.location.href = new_url;
}
if (!$('#site-search-box').length){
$("nav.courseware").find("ol").append(lb + "section style='float:right'" + rlb + "input size='20'"
+ " id='site-search-box'"
+ rlb + "img src='" + course_static_url
+ "/images_search_glass.png'/" + rlb + "/input" + rlb + "/section" + rb);
}
$("#site-search-box").keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
go_to_search();
}
});
// $('#site-search-box').bind("enterKey", go_to_search);
var get = function(x){
return eval(x);
}
return {'course_static_url': course_static_url,
'jump_to_url': jump_to_url,
'go_to_search': go_to_search,
'get_search_module': get_search_module,
'get_search_module_ficus': get_search_module_ficus,
'get': get,
}
}
var the_site_search = add_site_search();
var add_fix_transcript = function(){
if ($('div.wrap-instructor-info').length==0){
return;
}
$('div.xblock-student_view-video').each(function(key, vblock_e){
var vblock = $(vblock_e);
var vuid = vblock.data('usage-id').split('@');
var vid;
if (vuid.length==1){
vuid = vblock.data('usage-id').split(';_')
vid = vuid[5];
}else{
vid = vuid[2];
}
var mfnpre = vid.split("_video",1)[0];
var mfnid = mfnpre; // no periods
mfnpre = mfnpre.replace('8_370', '8.370'); // periods in gh filename
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var mke = function(x){ return lb + x + rb; }
var ftid = "fix_transcript_" + mfnid;
if (!$('#' + ftid).length){
var html = lb + "span id='" + ftid + "' style='float:right'" + rb + lb + "a href='#'" + rb;
html += "contribute transcript fix" + mke("/a") + mke("/span");
console.log("html = ", html);
vblock.after(html)
}
$('#' + ftid).click(function(){
var cst = $('ol.subtitles').find('li.current');
var cindex = Number(cst.data('index'));
var gurl;
if (mfnpre.endsWith('_cq_sol')){
gurl = "https://github.com/mitocw/content-mit-8370x-cq-sol-subtitles/blob/master/";
}else{
gurl = "https://github.com/mitocw/content-mit-8370x-subtitles/blob/master/";
}
gurl += mfnpre + ".txt#L" + String(cindex + 10 + 1);
console.log("going to ", gurl);
window.open(gurl, "MITx 8.370x subtitle source");
});
});
}
try{
add_fix_transcript();
}
catch(err){
console.log(err);
}
try{
var rb = String.fromCharCode(62);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 3000);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 8000);
}
catch(err){
console.log(err);
}
</script></span>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@vertical+block@Gate_teleportation" data-init="VerticalStudentView" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="vertical" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<h2 class="hd hd-2 unit-title">Gate teleportation</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@html_Gate_teleportation">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@html_Gate_teleportation" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="html" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p>
Gate teleportation is a neat and very useful concept for fault tolerant QC, via which Clifford and non-Clifford gates can be implemented using quantum teleportation, employing the appropriate entangled state and teleportation fixup operations. </p>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-rot-and-c3">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-rot-and-c3" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="problem" data-has-score="True" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_s12-wk7-rot-and-c3" class="problems-wrapper" role="group"
aria-labelledby="s12-wk7-rot-and-c3-problem-title"
data-problem-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-rot-and-c3" data-url="/courses/course-v1:MITx+8.371.2x+2T2018/xblock/block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-rot-and-c3/handler/xmodule_handler"
data-problem-score="0"
data-problem-total-possible="2"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="s12-wk7-rot-and-c3-problem-title" aria-describedby="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-rot-and-c3-problem-progress" tabindex="-1">
Rotation gates and the C3 family
</h3>
<div class="problem-progress" id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-rot-and-c3-problem-progress"></div>
<div class="problem">
<div>
<p>
When working with non-stabilizer single-qubit gates, it is often helpful to think of them in terms of rotations. Specifically, recall that single qubit rotations are defined as </p>
<table id="a0000000002" class="eqnarray" cellspacing="0" cellpadding="7" width="100%" style="table-layout:auto">
<tr id="a0000000003">
<td style="width:40%; border:none">&#160;</td>
<td style="vertical-align:middle; text-align:right; border:none">
[mathjaxinline]\displaystyle R_ x(\theta )[/mathjaxinline]
</td>
<td style="vertical-align:middle; text-align:center; border:none">
[mathjaxinline]\displaystyle =[/mathjaxinline]
</td>
<td style="vertical-align:middle; text-align:left; border:none">
[mathjaxinline]\displaystyle e^{-i\frac{\theta }{2} X}[/mathjaxinline]
</td>
<td style="width:40%; border:none">&#160;</td>
<td class="eqnnum" style="width:20%; border:none;text-align:right">(1.1)</td>
</tr>
<tr id="a0000000004">
<td style="width:40%; border:none">&#160;</td>
<td style="vertical-align:middle; text-align:right; border:none">
[mathjaxinline]\displaystyle R_ y(\theta )[/mathjaxinline]
</td>
<td style="vertical-align:middle; text-align:center; border:none">
[mathjaxinline]\displaystyle =[/mathjaxinline]
</td>
<td style="vertical-align:middle; text-align:left; border:none">
[mathjaxinline]\displaystyle e^{-i\frac{\theta }{2} Y}[/mathjaxinline]
</td>
<td style="width:40%; border:none">&#160;</td>
<td class="eqnnum" style="width:20%; border:none;text-align:right">(1.2)</td>
</tr>
<tr id="a0000000005">
<td style="width:40%; border:none">&#160;</td>
<td style="vertical-align:middle; text-align:right; border:none">
[mathjaxinline]\displaystyle R_ z(\theta )[/mathjaxinline]
</td>
<td style="vertical-align:middle; text-align:center; border:none">
[mathjaxinline]\displaystyle =[/mathjaxinline]
</td>
<td style="vertical-align:middle; text-align:left; border:none">
[mathjaxinline]\displaystyle e^{-i\frac{\theta }{2} Z} \, .[/mathjaxinline]
</td>
<td style="width:40%; border:none">&#160;</td>
<td class="eqnnum" style="width:20%; border:none;text-align:right">(1.3)</td>
</tr>
</table>
<ol class="enumerate">
<li value="1">
<p>
Express the Hadamard gate [mathjaxinline]H[/mathjaxinline] as a circuit using rotation gates. You may also include Pauli gates ([mathjaxinline]{\tt X}[/mathjaxinline],[mathjaxinline]{\tt Y}[/mathjaxinline], and [mathjaxinline]{\tt Z}[/mathjaxinline]) , if needed. Note that the determinant of any product of rotations of the above form is [mathjaxinline]+1[/mathjaxinline], whereas the determinants of [mathjaxinline]H[/mathjaxinline] and the Pauli gates is [mathjaxinline]-1[/mathjaxinline]. You may also include an overall [mathjaxinline]U(1)[/mathjaxinline] phase in your expression, if necessary. Your expression should be an exact expression for [mathjaxinline]H[/mathjaxinline] and should <em>not</em> differ by an overall phase. </p>
<p>
Input your answer as a quantum circuit, ie a list of gates, eg of the form [mathjaxinline]{\tt [exp(I*pi/3)*X(0),Rx(0,pi/4)]}[/mathjaxinline]. The gates are applied in order from left to right. Include a specification of which qubit (in this case, qubit [mathjaxinline]{\tt 0}[/mathjaxinline]) each gate is to act upon. A rotation gate [mathjaxinline]R_ x(\pi /4)[/mathjaxinline] on qubit [mathjaxinline]0[/mathjaxinline] is specified as [mathjaxinline]{\tt Rx(0,pi/4)}[/mathjaxinline]. Input [mathjaxinline]\sqrt{-1}[/mathjaxinline] as [mathjaxinline]{\tt I}[/mathjaxinline]. </p>
<p>
<span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="inputtype_s12-wk7-rot-and-c3_2_1" class=" capa_inputtype textline">
<div class="unanswered ">
<input type="text" name="input_s12-wk7-rot-and-c3_2_1" id="input_s12-wk7-rot-and-c3_2_1" aria-describedby="status_s12-wk7-rot-and-c3_2_1" value="" size="40"/>
<span class="trailing_text" id="trailing_text_s12-wk7-rot-and-c3_2_1"/>
<span class="status unanswered" id="status_s12-wk7-rot-and-c3_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p id="answer_s12-wk7-rot-and-c3_2_1" class="answer"/>
</div>
</div></div>
</span>
</p>
<p>
<div class="solution-span">
<span id="solution_s12-wk7-rot-and-c3_solution_1"/>
</div></p>
</li>
<li value="2">
<p>
[mathjaxinline]C_3[/mathjaxinline] is the set of all unitary transforms [mathjaxinline]U[/mathjaxinline] such that [mathjaxinline]U g U^\dagger \in C_2[/mathjaxinline] for all [mathjaxinline]g\in C_1[/mathjaxinline], where [mathjaxinline]C_1[/mathjaxinline] is the Pauli group, and [mathjaxinline]C_2[/mathjaxinline] is the Clifford group. Any quantum circuit can be composed from instances of [mathjaxinline]C_2[/mathjaxinline] gates and a nontrivial [mathjaxinline]C_3[/mathjaxinline] gate (one which is not in [mathjaxinline]C_2[/mathjaxinline]). </p>
<p>
Recall that </p>
<table id="a0000000006" class="equation" width="100%" cellspacing="0" cellpadding="7" style="table-layout:auto">
<tr>
<td class="equation" style="width:80%; border:none">[mathjax]T=\left(\begin{array}{cc} 1 &amp; 0 \\ 0 &amp; e^{i\pi /4}\end{array}\right) \, .[/mathjax]</td>
<td class="eqnnum" style="width:20%; border:none;text-align:right">(1.4)</td>
</tr>
</table>
<p>
This gate is in [mathjaxinline]C_3[/mathjaxinline]. It is insightful to express [mathjaxinline]T[/mathjaxinline] in terms of rotations, and compare with the expression for [mathjaxinline]H[/mathjaxinline]. </p>
<p>
Express [mathjaxinline]T[/mathjaxinline] as a circuit using rotation gates. Follow the same directions as given above, for [mathjaxinline]H[/mathjaxinline]. </p>
<p>
<span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 2" role="group"><div id="inputtype_s12-wk7-rot-and-c3_3_1" class=" capa_inputtype textline">
<div class="unanswered ">
<input type="text" name="input_s12-wk7-rot-and-c3_3_1" id="input_s12-wk7-rot-and-c3_3_1" aria-describedby="status_s12-wk7-rot-and-c3_3_1" value="" size="40"/>
<span class="trailing_text" id="trailing_text_s12-wk7-rot-and-c3_3_1"/>
<span class="status unanswered" id="status_s12-wk7-rot-and-c3_3_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p id="answer_s12-wk7-rot-and-c3_3_1" class="answer"/>
</div>
</div></div>
</span>
</p>
<p>
<div class="solution-span">
<span id="solution_s12-wk7-rot-and-c3_solution_2"/>
</div></p>
</li>
</ol>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Rotation gates and the C3 family" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_s12-wk7-rot-and-c3" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_s12-wk7-rot-and-c3">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
<span class="problem-action-button-wrapper">
<button type="button" class="save problem-action-btn btn-default btn-small" data-value="Save">
<span class="icon fa fa-floppy-o" aria-hidden="true"></span>
<span aria-hidden="true">Save</span>
<span class="sr">Save your answer</span>
</button>
</span>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-rot-and-c3-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-rot-and-c3-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-rot-and-c3-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-2" data-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box023171">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box023171" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="html" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<span><a href="/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/NONE" id="dummy_course_static_link" style="display:none"/><a href="/courses/course-v1:MITx+8.371.2x+2T2018/jump_to_id/NONE" id="dummy_jump_link" style="display:none"/><script type="text/javascript">
var add_site_search = function(){
course_static_url = $('#dummy_course_static_link').attr('href').replace('/NONE', '');
jump_to_url = $('#dummy_jump_link').attr('href').replace('/NONE', '');
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
String.prototype.startsWith = function (str){
return this.indexOf(str) === 0;
};
}
if(typeof(String.prototype.trim) === "undefined")
{
String.prototype.trim = function()
{
return String(this).replace(/^\s+|\s+$/g, '');
};
}
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var amp = String.fromCharCode(38);
var rlb = rb + lb;
var mke = function(x){ return lb + x + rb; }
var search_module_url = "";
var get_search_module_ficus = function(){
var cid = $('div.xblock').data('course-id');
if (cid){
console.log("cid = ", cid);
// search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/" + cid + "/courseware/welcome/Search_this_course/";
search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/courseware/welcome/Search_this_course/"; // automatically rewritten
console.log("3. search_module_url = ", search_module_url);
return;
}
var course_root_link = $('span.nav-item-course').find('a').attr('href');
if (course_root_link){
console.log("course_root_link = ", course_root_link);
search_module_url = course_root_link.replace("course/", "courseware/welcome/Search_this_course/");
console.log("2. search_module_url = ", search_module_url);
return
}
console.log("cannot determine search module url");
}
var get_search_module = function(){
// find search this module link
if (!($('div.course-index').length)){
return get_search_module_ficus();
}
$('div.course-index').find('nav').find('a').each(function(){
if ($(this).text().trim().startsWith("Search this course")){
search_module_url = $(this).attr('href');
console.log("search_module_url = ", search_module_url);
}
});
}
var go_to_search = function(){
get_search_module();
var sterm = $('#site-search-box').val();
// new_url = jump_to_url + "/Search_this_module/?q=" + sterm;
new_url = search_module_url + "?q=" + sterm;
console.log("sterm = ", sterm, " ; going to ", new_url);
window.location.href = new_url;
}
if (!$('#site-search-box').length){
$("nav.courseware").find("ol").append(lb + "section style='float:right'" + rlb + "input size='20'"
+ " id='site-search-box'"
+ rlb + "img src='" + course_static_url
+ "/images_search_glass.png'/" + rlb + "/input" + rlb + "/section" + rb);
}
$("#site-search-box").keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
go_to_search();
}
});
// $('#site-search-box').bind("enterKey", go_to_search);
var get = function(x){
return eval(x);
}
return {'course_static_url': course_static_url,
'jump_to_url': jump_to_url,
'go_to_search': go_to_search,
'get_search_module': get_search_module,
'get_search_module_ficus': get_search_module_ficus,
'get': get,
}
}
var the_site_search = add_site_search();
var add_fix_transcript = function(){
if ($('div.wrap-instructor-info').length==0){
return;
}
$('div.xblock-student_view-video').each(function(key, vblock_e){
var vblock = $(vblock_e);
var vuid = vblock.data('usage-id').split('@');
var vid;
if (vuid.length==1){
vuid = vblock.data('usage-id').split(';_')
vid = vuid[5];
}else{
vid = vuid[2];
}
var mfnpre = vid.split("_video",1)[0];
var mfnid = mfnpre; // no periods
mfnpre = mfnpre.replace('8_370', '8.370'); // periods in gh filename
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var mke = function(x){ return lb + x + rb; }
var ftid = "fix_transcript_" + mfnid;
if (!$('#' + ftid).length){
var html = lb + "span id='" + ftid + "' style='float:right'" + rb + lb + "a href='#'" + rb;
html += "contribute transcript fix" + mke("/a") + mke("/span");
console.log("html = ", html);
vblock.after(html)
}
$('#' + ftid).click(function(){
var cst = $('ol.subtitles').find('li.current');
var cindex = Number(cst.data('index'));
var gurl;
if (mfnpre.endsWith('_cq_sol')){
gurl = "https://github.com/mitocw/content-mit-8370x-cq-sol-subtitles/blob/master/";
}else{
gurl = "https://github.com/mitocw/content-mit-8370x-subtitles/blob/master/";
}
gurl += mfnpre + ".txt#L" + String(cindex + 10 + 1);
console.log("going to ", gurl);
window.open(gurl, "MITx 8.370x subtitle source");
});
});
}
try{
add_fix_transcript();
}
catch(err){
console.log(err);
}
try{
var rb = String.fromCharCode(62);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 3000);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 8000);
}
catch(err){
console.log(err);
}
</script></span>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@vertical+block@One-qubit_teleportation_circuits" data-init="VerticalStudentView" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="vertical" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<h2 class="hd hd-2 unit-title">One-qubit teleportation circuits</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-one-qubit-telep">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-one-qubit-telep" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="problem" data-has-score="True" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_s12-wk7-one-qubit-telep" class="problems-wrapper" role="group"
aria-labelledby="s12-wk7-one-qubit-telep-problem-title"
data-problem-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-one-qubit-telep" data-url="/courses/course-v1:MITx+8.371.2x+2T2018/xblock/block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-one-qubit-telep/handler/xmodule_handler"
data-problem-score="0"
data-problem-total-possible="1"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="s12-wk7-one-qubit-telep-problem-title" aria-describedby="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-one-qubit-telep-problem-progress" tabindex="-1">
One-qubit teleportation circuits
</h3>
<div class="problem-progress" id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-one-qubit-telep-problem-progress"></div>
<div class="problem">
<div>
<p>
In FTQC, it is convenient to use the following two circuits, which are each known as &#8220;one-qubit teleportation": </p>
<p>
<center>
<img src="/assets/courseware/v1/6139c5a764f87f92457b75e8f42a61b5/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/images_ps7-one-qubit-teleport-circuit-x.png" width="300"/>
</center>
</p>
<p>
<center>
<img src="/assets/courseware/v1/7ebc93b857e0f41651bd17301c389b05/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/images_ps7-one-qubit-teleport-circuit-z.png" width="300"/>
</center>
</p>
<p>
[mathjaxinline]X[/mathjaxinline]-teleportation is the top circuit, and [mathjaxinline]Z[/mathjaxinline]-teleportation is the bottom circuit. </p>
<p>
When constructing the fault-tolerant [mathjaxinline]T[/mathjaxinline] gate, we used [mathjaxinline]X[/mathjaxinline]-teleportation; this is because we needed to &#8220;push" the [mathjaxinline]T[/mathjaxinline] gate backwards, from the output to the input. We found that </p>
<table id="a0000000007" class="equation" width="100%" cellspacing="0" cellpadding="7" style="table-layout:auto">
<tr>
<td class="equation" style="width:80%; border:none">[mathjax]TX = \sqrt{-i} SX T \, ,[/mathjax]</td>
<td class="eqnnum" style="width:20%; border:none;text-align:right">(1.5)</td>
</tr>
</table>
<p>
and thus we could replace the classically controlled [mathjaxinline]X[/mathjaxinline] gate with a classically controlled [mathjaxinline]\sqrt{-i}SX[/mathjaxinline] gate. Then, because [mathjaxinline]T[/mathjaxinline] commutes with the control line of the CNOT gate, we could then conclude that [mathjaxinline]T[/mathjaxinline] could be realized using measurement in the computational basis, CNOT, and a [mathjaxinline]\sqrt{-i}SX[/mathjaxinline] gate, given ancilla qubits prepared in the state [mathjaxinline]TH|0\rangle[/mathjaxinline]. </p>
<p>
Here, we come up with a similar construction, for the gate </p>
<table id="a0000000008" class="equation" width="100%" cellspacing="0" cellpadding="7" style="table-layout:auto">
<tr>
<td class="equation" style="width:80%; border:none">[mathjax]V = R_ x(\pi /4) \, .[/mathjax]</td>
<td class="eqnnum" style="width:20%; border:none;text-align:right">(1.6)</td>
</tr>
</table>
<p>
For this construction, let us use [mathjaxinline]Z[/mathjaxinline]-teleportation. </p>
<p>
First let us push the [mathjaxinline]V[/mathjaxinline] gate from the output backwards, through the [mathjaxinline]Z[/mathjaxinline] gate: </p>
<p>
<center>
<img src="/assets/courseware/v1/5c454b8d032429bb370bbfd013602287/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/images_ps7-one-qubit-teleport-V2.png" width="670"/>
</center>
</p>
<p>
Give [mathjaxinline]W[/mathjaxinline]. </p>
<p>
Input your answer as a quantum circuit, ie a list of gates, eg of the form [mathjaxinline]{\tt [exp(I*pi/3)*X(0),Rx(0,pi/4)]}[/mathjaxinline]. The gates are applied in order from left to right. Include a specification of which qubit (in this case, qubit [mathjaxinline]{\tt 0}[/mathjaxinline]) each gate is to act upon. Input [mathjaxinline]\sqrt{-1}[/mathjaxinline] as [mathjaxinline]{\tt I}[/mathjaxinline]. You should only use gates in the Clifford group. Input [mathjaxinline]{\tt []}[/mathjaxinline] for an empty circuit (identity). </p>
<p>
[mathjaxinline]W = V Z V^\dagger =[/mathjaxinline] <span><div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="inputtype_s12-wk7-one-qubit-telep_2_1" class=" capa_inputtype textline">
<div class="unanswered ">
<input type="text" name="input_s12-wk7-one-qubit-telep_2_1" id="input_s12-wk7-one-qubit-telep_2_1" aria-describedby="status_s12-wk7-one-qubit-telep_2_1" value="" size="70"/>
<span class="trailing_text" id="trailing_text_s12-wk7-one-qubit-telep_2_1"/>
<span class="status unanswered" id="status_s12-wk7-one-qubit-telep_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p id="answer_s12-wk7-one-qubit-telep_2_1" class="answer"/>
</div>
</div></div></span> </p>
<p>
<div class="solution-span">
<span id="solution_s12-wk7-one-qubit-telep_solution_1"/>
</div></p>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="One-qubit teleportation circuits" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_s12-wk7-one-qubit-telep" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_s12-wk7-one-qubit-telep">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
<span class="problem-action-button-wrapper">
<button type="button" class="save problem-action-btn btn-default btn-small" data-value="Save">
<span class="icon fa fa-floppy-o" aria-hidden="true"></span>
<span aria-hidden="true">Save</span>
<span class="sr">Save your answer</span>
</button>
</span>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-one-qubit-telep-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-one-qubit-telep-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-one-qubit-telep-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-one-qubit-telep2">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-one-qubit-telep2" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="problem" data-has-score="True" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<p>Could not format HTML for problem. Contact course staff in the discussion forum for assistance.</p>
</div>
</div>
<div class="vert vert-2" data-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box023172">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box023172" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="html" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<span><a href="/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/NONE" id="dummy_course_static_link" style="display:none"/><a href="/courses/course-v1:MITx+8.371.2x+2T2018/jump_to_id/NONE" id="dummy_jump_link" style="display:none"/><script type="text/javascript">
var add_site_search = function(){
course_static_url = $('#dummy_course_static_link').attr('href').replace('/NONE', '');
jump_to_url = $('#dummy_jump_link').attr('href').replace('/NONE', '');
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
String.prototype.startsWith = function (str){
return this.indexOf(str) === 0;
};
}
if(typeof(String.prototype.trim) === "undefined")
{
String.prototype.trim = function()
{
return String(this).replace(/^\s+|\s+$/g, '');
};
}
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var amp = String.fromCharCode(38);
var rlb = rb + lb;
var mke = function(x){ return lb + x + rb; }
var search_module_url = "";
var get_search_module_ficus = function(){
var cid = $('div.xblock').data('course-id');
if (cid){
console.log("cid = ", cid);
// search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/" + cid + "/courseware/welcome/Search_this_course/";
search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/courseware/welcome/Search_this_course/"; // automatically rewritten
console.log("3. search_module_url = ", search_module_url);
return;
}
var course_root_link = $('span.nav-item-course').find('a').attr('href');
if (course_root_link){
console.log("course_root_link = ", course_root_link);
search_module_url = course_root_link.replace("course/", "courseware/welcome/Search_this_course/");
console.log("2. search_module_url = ", search_module_url);
return
}
console.log("cannot determine search module url");
}
var get_search_module = function(){
// find search this module link
if (!($('div.course-index').length)){
return get_search_module_ficus();
}
$('div.course-index').find('nav').find('a').each(function(){
if ($(this).text().trim().startsWith("Search this course")){
search_module_url = $(this).attr('href');
console.log("search_module_url = ", search_module_url);
}
});
}
var go_to_search = function(){
get_search_module();
var sterm = $('#site-search-box').val();
// new_url = jump_to_url + "/Search_this_module/?q=" + sterm;
new_url = search_module_url + "?q=" + sterm;
console.log("sterm = ", sterm, " ; going to ", new_url);
window.location.href = new_url;
}
if (!$('#site-search-box').length){
$("nav.courseware").find("ol").append(lb + "section style='float:right'" + rlb + "input size='20'"
+ " id='site-search-box'"
+ rlb + "img src='" + course_static_url
+ "/images_search_glass.png'/" + rlb + "/input" + rlb + "/section" + rb);
}
$("#site-search-box").keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
go_to_search();
}
});
// $('#site-search-box').bind("enterKey", go_to_search);
var get = function(x){
return eval(x);
}
return {'course_static_url': course_static_url,
'jump_to_url': jump_to_url,
'go_to_search': go_to_search,
'get_search_module': get_search_module,
'get_search_module_ficus': get_search_module_ficus,
'get': get,
}
}
var the_site_search = add_site_search();
var add_fix_transcript = function(){
if ($('div.wrap-instructor-info').length==0){
return;
}
$('div.xblock-student_view-video').each(function(key, vblock_e){
var vblock = $(vblock_e);
var vuid = vblock.data('usage-id').split('@');
var vid;
if (vuid.length==1){
vuid = vblock.data('usage-id').split(';_')
vid = vuid[5];
}else{
vid = vuid[2];
}
var mfnpre = vid.split("_video",1)[0];
var mfnid = mfnpre; // no periods
mfnpre = mfnpre.replace('8_370', '8.370'); // periods in gh filename
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var mke = function(x){ return lb + x + rb; }
var ftid = "fix_transcript_" + mfnid;
if (!$('#' + ftid).length){
var html = lb + "span id='" + ftid + "' style='float:right'" + rb + lb + "a href='#'" + rb;
html += "contribute transcript fix" + mke("/a") + mke("/span");
console.log("html = ", html);
vblock.after(html)
}
$('#' + ftid).click(function(){
var cst = $('ol.subtitles').find('li.current');
var cindex = Number(cst.data('index'));
var gurl;
if (mfnpre.endsWith('_cq_sol')){
gurl = "https://github.com/mitocw/content-mit-8370x-cq-sol-subtitles/blob/master/";
}else{
gurl = "https://github.com/mitocw/content-mit-8370x-subtitles/blob/master/";
}
gurl += mfnpre + ".txt#L" + String(cindex + 10 + 1);
console.log("going to ", gurl);
window.open(gurl, "MITx 8.370x subtitle source");
});
});
}
try{
add_fix_transcript();
}
catch(err){
console.log(err);
}
try{
var rb = String.fromCharCode(62);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 3000);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 8000);
}
catch(err){
console.log(err);
}
</script></span>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@vertical+block@Toffoli_gate_is_in_C3" data-init="VerticalStudentView" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="vertical" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<h2 class="hd hd-2 unit-title">Toffoli gate is in C3</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-toffoli-c3">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-toffoli-c3" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="problem" data-has-score="True" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_s12-wk7-toffoli-c3" class="problems-wrapper" role="group"
aria-labelledby="s12-wk7-toffoli-c3-problem-title"
data-problem-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-toffoli-c3" data-url="/courses/course-v1:MITx+8.371.2x+2T2018/xblock/block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-toffoli-c3/handler/xmodule_handler"
data-problem-score="0"
data-problem-total-possible="2"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="s12-wk7-toffoli-c3-problem-title" aria-describedby="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-toffoli-c3-problem-progress" tabindex="-1">
Toffoli gate is in C3
</h3>
<div class="problem-progress" id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-toffoli-c3-problem-progress"></div>
<div class="problem">
<div>
<p>
Recall that [mathjaxinline]C_3[/mathjaxinline] is the set of all unitary transforms [mathjaxinline]U[/mathjaxinline] such that [mathjaxinline]U g U^\dagger \in C_2[/mathjaxinline] for all [mathjaxinline]g\in C_1[/mathjaxinline], where [mathjaxinline]C_1[/mathjaxinline] is the Pauli group, and [mathjaxinline]C_2[/mathjaxinline] is the Clifford group. </p>
<p>
Here, we show that the Toffoli gate, which is the controlled-controlled-NOT gate, is in [mathjaxinline]C_3[/mathjaxinline] (colloquially, we say that &#8220;the Toffoli is a [mathjaxinline]C_3[/mathjaxinline] gate"). The only two nontrivial cases to consider are: </p>
<ol class="enumerate">
<li value="1">
<p>
Commuting [mathjaxinline]X[/mathjaxinline] through one of the control qubits of the Toffoli gate: <center><img src="/assets/courseware/v1/864752d0e3e5ae2471a8c395fa815c9a/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/images_ps7-toffoli-commute-X.png" width="400"/></center> </p>
<p>
Give [mathjaxinline]U[/mathjaxinline]. Input your answer as a quantum circuit, ie a list of gates, eg of the form [mathjaxinline]{\tt [X(0),X(2),CNOT(1,2),CPHASE(0,2)]}[/mathjaxinline]. The gates are applied in order from left to right, and qubits are numbered starting with [mathjaxinline]0[/mathjaxinline], from the bottom. </p>
<p>
<p style="display:inline">[mathjaxinline]U=[/mathjaxinline]</p>
<span>
<div class="inline" tabindex="-1" aria-label="Question 1" role="group"><div id="inputtype_s12-wk7-toffoli-c3_2_1" class=" capa_inputtype inline textline">
<div class="unanswered inline">
<input type="text" name="input_s12-wk7-toffoli-c3_2_1" id="input_s12-wk7-toffoli-c3_2_1" aria-describedby="status_s12-wk7-toffoli-c3_2_1" value="" size="40"/>
<span class="trailing_text" id="trailing_text_s12-wk7-toffoli-c3_2_1"/>
<span class="status unanswered" id="status_s12-wk7-toffoli-c3_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p id="answer_s12-wk7-toffoli-c3_2_1" class="answer"/>
</div>
</div></div>
</span>
</p>
<p>
<div class="solution-span">
<span id="solution_s12-wk7-toffoli-c3_solution_1"/>
</div></p>
</li>
<li value="2">
<p>
Commuting [mathjaxinline]Z[/mathjaxinline] through the target qubit of the Toffoli gate: <center><img src="/assets/courseware/v1/cbb2924cc82181e2bd8f4d8d2921cb60/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/images_ps7-toffoli-commute-Z.png" width="400"/></center> </p>
<p>
Give [mathjaxinline]V[/mathjaxinline]. Input your answer as a quantum circuit, ie a list of gates, eg of the form [mathjaxinline]{\tt [X(0),X(2),CNOT(1,2),CPHASE(0,2)]}[/mathjaxinline]. The gates are applied in order from left to right, and qubits are numbered starting with [mathjaxinline]0[/mathjaxinline], from the bottom. </p>
<p>
<p style="display:inline">[mathjaxinline]V=[/mathjaxinline]</p>
<span>
<div class="inline" tabindex="-1" aria-label="Question 2" role="group"><div id="inputtype_s12-wk7-toffoli-c3_3_1" class=" capa_inputtype inline textline">
<div class="unanswered inline">
<input type="text" name="input_s12-wk7-toffoli-c3_3_1" id="input_s12-wk7-toffoli-c3_3_1" aria-describedby="status_s12-wk7-toffoli-c3_3_1" value="" size="40"/>
<span class="trailing_text" id="trailing_text_s12-wk7-toffoli-c3_3_1"/>
<span class="status unanswered" id="status_s12-wk7-toffoli-c3_3_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p id="answer_s12-wk7-toffoli-c3_3_1" class="answer"/>
</div>
</div></div>
</span>
</p>
<p>
<div class="solution-span">
<span id="solution_s12-wk7-toffoli-c3_solution_2"/>
</div></p>
</li>
</ol>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Toffoli gate is in C3" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_s12-wk7-toffoli-c3" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_s12-wk7-toffoli-c3">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
<span class="problem-action-button-wrapper">
<button type="button" class="save problem-action-btn btn-default btn-small" data-value="Save">
<span class="icon fa fa-floppy-o" aria-hidden="true"></span>
<span aria-hidden="true">Save</span>
<span class="sr">Save your answer</span>
</button>
</span>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-toffoli-c3-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-toffoli-c3-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-toffoli-c3-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box023173">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box023173" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="html" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<span><a href="/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/NONE" id="dummy_course_static_link" style="display:none"/><a href="/courses/course-v1:MITx+8.371.2x+2T2018/jump_to_id/NONE" id="dummy_jump_link" style="display:none"/><script type="text/javascript">
var add_site_search = function(){
course_static_url = $('#dummy_course_static_link').attr('href').replace('/NONE', '');
jump_to_url = $('#dummy_jump_link').attr('href').replace('/NONE', '');
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
String.prototype.startsWith = function (str){
return this.indexOf(str) === 0;
};
}
if(typeof(String.prototype.trim) === "undefined")
{
String.prototype.trim = function()
{
return String(this).replace(/^\s+|\s+$/g, '');
};
}
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var amp = String.fromCharCode(38);
var rlb = rb + lb;
var mke = function(x){ return lb + x + rb; }
var search_module_url = "";
var get_search_module_ficus = function(){
var cid = $('div.xblock').data('course-id');
if (cid){
console.log("cid = ", cid);
// search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/" + cid + "/courseware/welcome/Search_this_course/";
search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/courseware/welcome/Search_this_course/"; // automatically rewritten
console.log("3. search_module_url = ", search_module_url);
return;
}
var course_root_link = $('span.nav-item-course').find('a').attr('href');
if (course_root_link){
console.log("course_root_link = ", course_root_link);
search_module_url = course_root_link.replace("course/", "courseware/welcome/Search_this_course/");
console.log("2. search_module_url = ", search_module_url);
return
}
console.log("cannot determine search module url");
}
var get_search_module = function(){
// find search this module link
if (!($('div.course-index').length)){
return get_search_module_ficus();
}
$('div.course-index').find('nav').find('a').each(function(){
if ($(this).text().trim().startsWith("Search this course")){
search_module_url = $(this).attr('href');
console.log("search_module_url = ", search_module_url);
}
});
}
var go_to_search = function(){
get_search_module();
var sterm = $('#site-search-box').val();
// new_url = jump_to_url + "/Search_this_module/?q=" + sterm;
new_url = search_module_url + "?q=" + sterm;
console.log("sterm = ", sterm, " ; going to ", new_url);
window.location.href = new_url;
}
if (!$('#site-search-box').length){
$("nav.courseware").find("ol").append(lb + "section style='float:right'" + rlb + "input size='20'"
+ " id='site-search-box'"
+ rlb + "img src='" + course_static_url
+ "/images_search_glass.png'/" + rlb + "/input" + rlb + "/section" + rb);
}
$("#site-search-box").keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
go_to_search();
}
});
// $('#site-search-box').bind("enterKey", go_to_search);
var get = function(x){
return eval(x);
}
return {'course_static_url': course_static_url,
'jump_to_url': jump_to_url,
'go_to_search': go_to_search,
'get_search_module': get_search_module,
'get_search_module_ficus': get_search_module_ficus,
'get': get,
}
}
var the_site_search = add_site_search();
var add_fix_transcript = function(){
if ($('div.wrap-instructor-info').length==0){
return;
}
$('div.xblock-student_view-video').each(function(key, vblock_e){
var vblock = $(vblock_e);
var vuid = vblock.data('usage-id').split('@');
var vid;
if (vuid.length==1){
vuid = vblock.data('usage-id').split(';_')
vid = vuid[5];
}else{
vid = vuid[2];
}
var mfnpre = vid.split("_video",1)[0];
var mfnid = mfnpre; // no periods
mfnpre = mfnpre.replace('8_370', '8.370'); // periods in gh filename
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var mke = function(x){ return lb + x + rb; }
var ftid = "fix_transcript_" + mfnid;
if (!$('#' + ftid).length){
var html = lb + "span id='" + ftid + "' style='float:right'" + rb + lb + "a href='#'" + rb;
html += "contribute transcript fix" + mke("/a") + mke("/span");
console.log("html = ", html);
vblock.after(html)
}
$('#' + ftid).click(function(){
var cst = $('ol.subtitles').find('li.current');
var cindex = Number(cst.data('index'));
var gurl;
if (mfnpre.endsWith('_cq_sol')){
gurl = "https://github.com/mitocw/content-mit-8370x-cq-sol-subtitles/blob/master/";
}else{
gurl = "https://github.com/mitocw/content-mit-8370x-subtitles/blob/master/";
}
gurl += mfnpre + ".txt#L" + String(cindex + 10 + 1);
console.log("going to ", gurl);
window.open(gurl, "MITx 8.370x subtitle source");
});
});
}
try{
add_fix_transcript();
}
catch(err){
console.log(err);
}
try{
var rb = String.fromCharCode(62);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 3000);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 8000);
}
catch(err){
console.log(err);
}
</script></span>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@vertical+block@Teleporting_the_Toffoli_gate" data-init="VerticalStudentView" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="vertical" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<h2 class="hd hd-2 unit-title">Teleporting the Toffoli gate</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-toffoli-telep">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-toffoli-telep" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="problem" data-has-score="True" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<p>Could not format HTML for problem. Contact course staff in the discussion forum for assistance.</p>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box023174">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box023174" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="html" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<span><a href="/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/NONE" id="dummy_course_static_link" style="display:none"/><a href="/courses/course-v1:MITx+8.371.2x+2T2018/jump_to_id/NONE" id="dummy_jump_link" style="display:none"/><script type="text/javascript">
var add_site_search = function(){
course_static_url = $('#dummy_course_static_link').attr('href').replace('/NONE', '');
jump_to_url = $('#dummy_jump_link').attr('href').replace('/NONE', '');
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
String.prototype.startsWith = function (str){
return this.indexOf(str) === 0;
};
}
if(typeof(String.prototype.trim) === "undefined")
{
String.prototype.trim = function()
{
return String(this).replace(/^\s+|\s+$/g, '');
};
}
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var amp = String.fromCharCode(38);
var rlb = rb + lb;
var mke = function(x){ return lb + x + rb; }
var search_module_url = "";
var get_search_module_ficus = function(){
var cid = $('div.xblock').data('course-id');
if (cid){
console.log("cid = ", cid);
// search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/" + cid + "/courseware/welcome/Search_this_course/";
search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/courseware/welcome/Search_this_course/"; // automatically rewritten
console.log("3. search_module_url = ", search_module_url);
return;
}
var course_root_link = $('span.nav-item-course').find('a').attr('href');
if (course_root_link){
console.log("course_root_link = ", course_root_link);
search_module_url = course_root_link.replace("course/", "courseware/welcome/Search_this_course/");
console.log("2. search_module_url = ", search_module_url);
return
}
console.log("cannot determine search module url");
}
var get_search_module = function(){
// find search this module link
if (!($('div.course-index').length)){
return get_search_module_ficus();
}
$('div.course-index').find('nav').find('a').each(function(){
if ($(this).text().trim().startsWith("Search this course")){
search_module_url = $(this).attr('href');
console.log("search_module_url = ", search_module_url);
}
});
}
var go_to_search = function(){
get_search_module();
var sterm = $('#site-search-box').val();
// new_url = jump_to_url + "/Search_this_module/?q=" + sterm;
new_url = search_module_url + "?q=" + sterm;
console.log("sterm = ", sterm, " ; going to ", new_url);
window.location.href = new_url;
}
if (!$('#site-search-box').length){
$("nav.courseware").find("ol").append(lb + "section style='float:right'" + rlb + "input size='20'"
+ " id='site-search-box'"
+ rlb + "img src='" + course_static_url
+ "/images_search_glass.png'/" + rlb + "/input" + rlb + "/section" + rb);
}
$("#site-search-box").keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
go_to_search();
}
});
// $('#site-search-box').bind("enterKey", go_to_search);
var get = function(x){
return eval(x);
}
return {'course_static_url': course_static_url,
'jump_to_url': jump_to_url,
'go_to_search': go_to_search,
'get_search_module': get_search_module,
'get_search_module_ficus': get_search_module_ficus,
'get': get,
}
}
var the_site_search = add_site_search();
var add_fix_transcript = function(){
if ($('div.wrap-instructor-info').length==0){
return;
}
$('div.xblock-student_view-video').each(function(key, vblock_e){
var vblock = $(vblock_e);
var vuid = vblock.data('usage-id').split('@');
var vid;
if (vuid.length==1){
vuid = vblock.data('usage-id').split(';_')
vid = vuid[5];
}else{
vid = vuid[2];
}
var mfnpre = vid.split("_video",1)[0];
var mfnid = mfnpre; // no periods
mfnpre = mfnpre.replace('8_370', '8.370'); // periods in gh filename
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var mke = function(x){ return lb + x + rb; }
var ftid = "fix_transcript_" + mfnid;
if (!$('#' + ftid).length){
var html = lb + "span id='" + ftid + "' style='float:right'" + rb + lb + "a href='#'" + rb;
html += "contribute transcript fix" + mke("/a") + mke("/span");
console.log("html = ", html);
vblock.after(html)
}
$('#' + ftid).click(function(){
var cst = $('ol.subtitles').find('li.current');
var cindex = Number(cst.data('index'));
var gurl;
if (mfnpre.endsWith('_cq_sol')){
gurl = "https://github.com/mitocw/content-mit-8370x-cq-sol-subtitles/blob/master/";
}else{
gurl = "https://github.com/mitocw/content-mit-8370x-subtitles/blob/master/";
}
gurl += mfnpre + ".txt#L" + String(cindex + 10 + 1);
console.log("going to ", gurl);
window.open(gurl, "MITx 8.370x subtitle source");
});
});
}
try{
add_fix_transcript();
}
catch(err){
console.log(err);
}
try{
var rb = String.fromCharCode(62);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 3000);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 8000);
}
catch(err){
console.log(err);
}
</script></span>
</div>
</div>
</div>
</div>
<div class="xblock xblock-public_view xblock-public_view-vertical" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@vertical+block@Teleporting_a_Z-rotation_gate" data-init="VerticalStudentView" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="vertical" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<h2 class="hd hd-2 unit-title">Teleporting a Z-rotation gate</h2>
<div class="vert-mod">
<div class="vert vert-0" data-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-teleport-rz">
<div class="xblock xblock-public_view xblock-public_view-problem xmodule_display xmodule_ProblemBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-teleport-rz" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="problem" data-has-score="True" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_s12-wk7-teleport-rz" class="problems-wrapper" role="group"
aria-labelledby="s12-wk7-teleport-rz-problem-title"
data-problem-id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-teleport-rz" data-url="/courses/course-v1:MITx+8.371.2x+2T2018/xblock/block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-teleport-rz/handler/xmodule_handler"
data-problem-score="0"
data-problem-total-possible="4"
data-attempts-used="0"
data-content="
<h3 class="hd hd-3 problem-header" id="s12-wk7-teleport-rz-problem-title" aria-describedby="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-teleport-rz-problem-progress" tabindex="-1">
Teleporting a Z-rotation gate
</h3>
<div class="problem-progress" id="block-v1:MITx+8.371.2x+2T2018+type@problem+block@s12-wk7-teleport-rz-problem-progress"></div>
<div class="problem">
<div>
<p>
Certain [mathjaxinline]C_3[/mathjaxinline] gates may be implemented using a circuit which is somewhat simpler than the constructions derived directly from [mathjaxinline]X[/mathjaxinline] or [mathjaxinline]Z[/mathjaxinline]-teleportation. </p>
<p>
Consider the gate </p>
<table id="a0000000009" class="equation" width="100%" cellspacing="0" cellpadding="7" style="table-layout:auto">
<tr>
<td class="equation" style="width:80%; border:none">[mathjax]U_\theta =\left(\begin{array}{cc} 1 &amp; 0 \\ 0 &amp; e^{i\theta } \end{array}\right) \, ,[/mathjax]</td>
<td class="eqnnum" style="width:20%; border:none;text-align:right">(1.7)</td>
</tr>
</table>
<p>
which is the rotation [mathjaxinline]e^{-i\theta /2} R_ z(\theta /2)[/mathjaxinline]. Suppose that we have available the state </p>
<table id="a0000000010" class="equation" width="100%" cellspacing="0" cellpadding="7" style="table-layout:auto">
<tr>
<td class="equation" style="width:80%; border:none">[mathjax]U_\theta |+\rangle = \frac{|0\rangle +e^{i\theta }|1\rangle }{\sqrt{2}} \, .[/mathjax]</td>
<td class="eqnnum" style="width:20%; border:none;text-align:right">(1.8)</td>
</tr>
</table>
<p>
Let us work out what happens to this state through this circuit: </p>
<p>
<center>
<img src="/assets/courseware/v1/7879c217ac04ef8e6c06cd3a01fe34b6/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/images_ps7-teleport-utheta-noans.png" width="500"/>
</center>
</p>
<p>
Let [mathjaxinline]|\psi \rangle = a|0\rangle +b|1\rangle[/mathjaxinline]. Suppressing the [mathjaxinline]\sqrt{2}[/mathjaxinline] normalization, the initial state is </p>
<table id="a0000000011" class="eqnarray" cellspacing="0" cellpadding="7" width="100%" style="table-layout:auto">
<tr id="a0000000012">
<td style="width:40%; border:none">&#160;</td>
<td style="vertical-align:middle; text-align:right; border:none">
[mathjaxinline]\displaystyle |s_0\rangle[/mathjaxinline]
</td>
<td style="vertical-align:middle; text-align:center; border:none">
[mathjaxinline]\displaystyle =[/mathjaxinline]
</td>
<td style="vertical-align:middle; text-align:left; border:none">
[mathjaxinline]\displaystyle (a|0\rangle +b|1\rangle ) (|0\rangle +e^{i\theta }|1\rangle )[/mathjaxinline]
</td>
<td style="width:40%; border:none">&#160;</td>
<td class="eqnnum" style="width:20%; border:none;text-align:right">(1.9)</td>
</tr>
<tr id="a0000000013">
<td style="width:40%; border:none">&#160;</td>
<td style="vertical-align:middle; text-align:right; border:none">
&#160;
</td>
<td style="vertical-align:middle; text-align:center; border:none">
[mathjaxinline]\displaystyle =[/mathjaxinline]
</td>
<td style="vertical-align:middle; text-align:left; border:none">
[mathjaxinline]\displaystyle a|00\rangle + ae^{i\theta } |01\rangle +b|10\rangle + b e^{i\theta }|11\rangle[/mathjaxinline]
</td>
<td style="width:40%; border:none">&#160;</td>
<td class="eqnnum" style="width:20%; border:none;text-align:right">(1.10)</td>
</tr>
</table>
<p>
Input your answers for the states, below, using explicit [mathjaxinline]{\tt *}[/mathjaxinline] for multiplication, spelling out greek symbols, and using [mathjaxinline]{\tt exp(x)}[/mathjaxinline] for [mathjaxinline]e^ x[/mathjaxinline]. For example, [mathjaxinline]|s_0\rangle[/mathjaxinline] would be expressed as <tt class="tt">a*|00&gt;+ a*exp(I*theta) * |01&gt;+b*|10&gt; + b* exp(I*theta)*|11&gt;</tt>. </p>
<ol class="enumerate">
<li value="1">
<p>
Give the state [mathjaxinline]|s_1\rangle[/mathjaxinline] after the CNOT gate. </p>
<p>
<p style="display:inline">[mathjaxinline]|s_1\rangle =[/mathjaxinline]</p>
<span>
<div class="inline" tabindex="-1" aria-label="Question 1" role="group"><div id="inputtype_s12-wk7-teleport-rz_2_1" class="text-input-dynamath capa_inputtype inline textline">
<div class="text-input-dynamath_data inline" data-preprocessor="MathjaxPreprocessorForQM"/>
<div class="script_placeholder" data-src="/assets/courseware/v1/dc8916af8ae257e4388dae38f570cb8b/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/mathjax_preprocessor_for_QM_subtext.js"/>
<div class="unanswered inline">
<input type="text" name="input_s12-wk7-teleport-rz_2_1" id="input_s12-wk7-teleport-rz_2_1" aria-describedby="status_s12-wk7-teleport-rz_2_1" value="" class="math" size="60"/>
<span class="trailing_text" id="trailing_text_s12-wk7-teleport-rz_2_1"/>
<span class="status unanswered" id="status_s12-wk7-teleport-rz_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p id="answer_s12-wk7-teleport-rz_2_1" class="answer"/>
<div id="display_s12-wk7-teleport-rz_2_1" class="equation">`{::}`</div>
<textarea style="display:none" id="input_s12-wk7-teleport-rz_2_1_dynamath" name="input_s12-wk7-teleport-rz_2_1_dynamath"/>
</div>
</div></div>
</span>
</p>
</li>
<li value="2">
<p>
Give the (single qubit) state [mathjaxinline]|s_2\rangle[/mathjaxinline] after the measurement, assuming the measurement result is [mathjaxinline]a=0[/mathjaxinline]. </p>
<p>
<p style="display:inline">[mathjaxinline]|s_2\rangle |_{a=0} =[/mathjaxinline]</p>
<span>
<div class="inline" tabindex="-1" aria-label="Question 2" role="group"><div id="inputtype_s12-wk7-teleport-rz_3_1" class="text-input-dynamath capa_inputtype inline textline">
<div class="text-input-dynamath_data inline" data-preprocessor="MathjaxPreprocessorForQM"/>
<div class="script_placeholder" data-src="/assets/courseware/v1/dc8916af8ae257e4388dae38f570cb8b/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/mathjax_preprocessor_for_QM_subtext.js"/>
<div class="unanswered inline">
<input type="text" name="input_s12-wk7-teleport-rz_3_1" id="input_s12-wk7-teleport-rz_3_1" aria-describedby="status_s12-wk7-teleport-rz_3_1" value="" class="math" size="60"/>
<span class="trailing_text" id="trailing_text_s12-wk7-teleport-rz_3_1"/>
<span class="status unanswered" id="status_s12-wk7-teleport-rz_3_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p id="answer_s12-wk7-teleport-rz_3_1" class="answer"/>
<div id="display_s12-wk7-teleport-rz_3_1" class="equation">`{::}`</div>
<textarea style="display:none" id="input_s12-wk7-teleport-rz_3_1_dynamath" name="input_s12-wk7-teleport-rz_3_1_dynamath"/>
</div>
</div></div>
</span>
</p>
</li>
<li value="3">
<p>
Give the (single qubit) state [mathjaxinline]|s_2\rangle[/mathjaxinline] after the measurement, assuming the measurement result is [mathjaxinline]a=1[/mathjaxinline]. </p>
<p>
<p style="display:inline">[mathjaxinline]|s_2\rangle |_{a=1} =[/mathjaxinline]</p>
<span>
<div class="inline" tabindex="-1" aria-label="Question 3" role="group"><div id="inputtype_s12-wk7-teleport-rz_4_1" class="text-input-dynamath capa_inputtype inline textline">
<div class="text-input-dynamath_data inline" data-preprocessor="MathjaxPreprocessorForQM"/>
<div class="script_placeholder" data-src="/assets/courseware/v1/dc8916af8ae257e4388dae38f570cb8b/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/mathjax_preprocessor_for_QM_subtext.js"/>
<div class="unanswered inline">
<input type="text" name="input_s12-wk7-teleport-rz_4_1" id="input_s12-wk7-teleport-rz_4_1" aria-describedby="status_s12-wk7-teleport-rz_4_1" value="" class="math" size="60"/>
<span class="trailing_text" id="trailing_text_s12-wk7-teleport-rz_4_1"/>
<span class="status unanswered" id="status_s12-wk7-teleport-rz_4_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p id="answer_s12-wk7-teleport-rz_4_1" class="answer"/>
<div id="display_s12-wk7-teleport-rz_4_1" class="equation">`{::}`</div>
<textarea style="display:none" id="input_s12-wk7-teleport-rz_4_1_dynamath" name="input_s12-wk7-teleport-rz_4_1_dynamath"/>
</div>
</div></div>
</span>
</p>
<p>
<div class="solution-span">
<span id="solution_s12-wk7-teleport-rz_solution_1"/>
</div></p>
</li>
<li value="4">
<p>
Give the (single qubit) state [mathjaxinline]|s_3\rangle[/mathjaxinline]: </p>
<p>
<p style="display:inline">[mathjaxinline]|s_3\rangle =[/mathjaxinline]</p>
<span>
<div class="inline" tabindex="-1" aria-label="Question 4" role="group"><div id="inputtype_s12-wk7-teleport-rz_5_1" class="text-input-dynamath capa_inputtype inline textline">
<div class="text-input-dynamath_data inline" data-preprocessor="MathjaxPreprocessorForQM"/>
<div class="script_placeholder" data-src="/assets/courseware/v1/dc8916af8ae257e4388dae38f570cb8b/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/mathjax_preprocessor_for_QM_subtext.js"/>
<div class="unanswered inline">
<input type="text" name="input_s12-wk7-teleport-rz_5_1" id="input_s12-wk7-teleport-rz_5_1" aria-describedby="status_s12-wk7-teleport-rz_5_1" value="" class="math" size="60"/>
<span class="trailing_text" id="trailing_text_s12-wk7-teleport-rz_5_1"/>
<span class="status unanswered" id="status_s12-wk7-teleport-rz_5_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p id="answer_s12-wk7-teleport-rz_5_1" class="answer"/>
<div id="display_s12-wk7-teleport-rz_5_1" class="equation">`{::}`</div>
<textarea style="display:none" id="input_s12-wk7-teleport-rz_5_1_dynamath" name="input_s12-wk7-teleport-rz_5_1_dynamath"/>
</div>
</div></div>
</span>
</p>
</li>
</ol>
<p>
<div class="solution-span">
<span id="solution_s12-wk7-teleport-rz_solution_2"/>
</div></p>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Teleporting a Z-rotation gate" />
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_s12-wk7-teleport-rz" >
<span class="submit-label">Submit</span>
</button>
<div class="submission-feedback" id="submission_feedback_s12-wk7-teleport-rz">
<span class="sr">Some problems have options such as save, reset, hints, or show answer. These options follow the Submit button.</span>
</div>
</div>
<div class="problem-action-buttons-wrapper">
<span class="problem-action-button-wrapper">
<button type="button" class="save problem-action-btn btn-default btn-small" data-value="Save">
<span class="icon fa fa-floppy-o" aria-hidden="true"></span>
<span aria-hidden="true">Save</span>
<span class="sr">Save your answer</span>
</button>
</span>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-teleport-rz-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-teleport-rz-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification general notification-show-answer
is-hidden"
tabindex="-1">
<span class="icon fa fa-info-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="s12-wk7-teleport-rz-problem-title">Answers are displayed within the problem
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-1" data-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box023175">
<div class="xblock xblock-public_view xblock-public_view-html xmodule_display xmodule_HtmlBlock" data-runtime-class="LmsRuntime" data-usage-id="block-v1:MITx+8.371.2x+2T2018+type@html+block@site_search_box023175" data-init="XBlockToXModuleShim" data-runtime-version="1" data-course-id="course-v1:MITx+8.371.2x+2T2018" data-block-type="html" data-has-score="False" data-graded="True" data-request-token="042d559e017f11ef9cc616fff75c5923">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<span><a href="/asset-v1:MITx+8.371.2x+2T2018+type@asset+block/NONE" id="dummy_course_static_link" style="display:none"/><a href="/courses/course-v1:MITx+8.371.2x+2T2018/jump_to_id/NONE" id="dummy_jump_link" style="display:none"/><script type="text/javascript">
var add_site_search = function(){
course_static_url = $('#dummy_course_static_link').attr('href').replace('/NONE', '');
jump_to_url = $('#dummy_jump_link').attr('href').replace('/NONE', '');
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
String.prototype.startsWith = function (str){
return this.indexOf(str) === 0;
};
}
if(typeof(String.prototype.trim) === "undefined")
{
String.prototype.trim = function()
{
return String(this).replace(/^\s+|\s+$/g, '');
};
}
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var amp = String.fromCharCode(38);
var rlb = rb + lb;
var mke = function(x){ return lb + x + rb; }
var search_module_url = "";
var get_search_module_ficus = function(){
var cid = $('div.xblock').data('course-id');
if (cid){
console.log("cid = ", cid);
// search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/" + cid + "/courseware/welcome/Search_this_course/";
search_module_url = "/courses/course-v1:MITx+8.371.2x+2T2018/courseware/welcome/Search_this_course/"; // automatically rewritten
console.log("3. search_module_url = ", search_module_url);
return;
}
var course_root_link = $('span.nav-item-course').find('a').attr('href');
if (course_root_link){
console.log("course_root_link = ", course_root_link);
search_module_url = course_root_link.replace("course/", "courseware/welcome/Search_this_course/");
console.log("2. search_module_url = ", search_module_url);
return
}
console.log("cannot determine search module url");
}
var get_search_module = function(){
// find search this module link
if (!($('div.course-index').length)){
return get_search_module_ficus();
}
$('div.course-index').find('nav').find('a').each(function(){
if ($(this).text().trim().startsWith("Search this course")){
search_module_url = $(this).attr('href');
console.log("search_module_url = ", search_module_url);
}
});
}
var go_to_search = function(){
get_search_module();
var sterm = $('#site-search-box').val();
// new_url = jump_to_url + "/Search_this_module/?q=" + sterm;
new_url = search_module_url + "?q=" + sterm;
console.log("sterm = ", sterm, " ; going to ", new_url);
window.location.href = new_url;
}
if (!$('#site-search-box').length){
$("nav.courseware").find("ol").append(lb + "section style='float:right'" + rlb + "input size='20'"
+ " id='site-search-box'"
+ rlb + "img src='" + course_static_url
+ "/images_search_glass.png'/" + rlb + "/input" + rlb + "/section" + rb);
}
$("#site-search-box").keypress(function(event) {
if (event.which == 13) {
event.preventDefault();
go_to_search();
}
});
// $('#site-search-box').bind("enterKey", go_to_search);
var get = function(x){
return eval(x);
}
return {'course_static_url': course_static_url,
'jump_to_url': jump_to_url,
'go_to_search': go_to_search,
'get_search_module': get_search_module,
'get_search_module_ficus': get_search_module_ficus,
'get': get,
}
}
var the_site_search = add_site_search();
var add_fix_transcript = function(){
if ($('div.wrap-instructor-info').length==0){
return;
}
$('div.xblock-student_view-video').each(function(key, vblock_e){
var vblock = $(vblock_e);
var vuid = vblock.data('usage-id').split('@');
var vid;
if (vuid.length==1){
vuid = vblock.data('usage-id').split(';_')
vid = vuid[5];
}else{
vid = vuid[2];
}
var mfnpre = vid.split("_video",1)[0];
var mfnid = mfnpre; // no periods
mfnpre = mfnpre.replace('8_370', '8.370'); // periods in gh filename
var lb = String.fromCharCode(60);
var rb = String.fromCharCode(62);
var mke = function(x){ return lb + x + rb; }
var ftid = "fix_transcript_" + mfnid;
if (!$('#' + ftid).length){
var html = lb + "span id='" + ftid + "' style='float:right'" + rb + lb + "a href='#'" + rb;
html += "contribute transcript fix" + mke("/a") + mke("/span");
console.log("html = ", html);
vblock.after(html)
}
$('#' + ftid).click(function(){
var cst = $('ol.subtitles').find('li.current');
var cindex = Number(cst.data('index'));
var gurl;
if (mfnpre.endsWith('_cq_sol')){
gurl = "https://github.com/mitocw/content-mit-8370x-cq-sol-subtitles/blob/master/";
}else{
gurl = "https://github.com/mitocw/content-mit-8370x-subtitles/blob/master/";
}
gurl += mfnpre + ".txt#L" + String(cindex + 10 + 1);
console.log("going to ", gurl);
window.open(gurl, "MITx 8.370x subtitle source");
});
});
}
try{
add_fix_transcript();
}
catch(err){
console.log(err);
}
try{
var rb = String.fromCharCode(62);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 3000);
setTimeout(function(){ $('.math' + rb + 'span').css("border-left-color","transparent"); }, 8000);
}
catch(err){
console.log(err);
}
</script></span>
</div>
</div>
</div>
</div>
© All Rights Reserved