{"id":3295,"date":"2023-05-23T18:38:36","date_gmt":"2023-05-23T18:38:36","guid":{"rendered":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/?post_type=chapter&#038;p=3295"},"modified":"2024-10-18T20:50:12","modified_gmt":"2024-10-18T20:50:12","slug":"logic-basics-learn-it-2","status":"web-only","type":"chapter","link":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/chapter\/logic-basics-learn-it-2\/","title":{"raw":"Logic Basics: Learn It 2","rendered":"Logic Basics: Learn It 2"},"content":{"raw":"<h2>Conditional Statements<\/h2>\r\n<p>Beyond searching, Boolean logic is commonly used in spreadsheet applications like Excel to do conditional calculations. A <strong>statement<\/strong> is something that is either true or false. A statement like [latex]3 &lt; 5[\/latex] is true; a statement like \u201ca rat is a fish\u201d is false. A statement like \u201c[latex]x &lt; 5[\/latex]\u201d is true for some values of [latex]x[\/latex] and false for others. When an action is taken or not depending on the value of a statement, it forms a <strong>conditional<\/strong>.<\/p>\r\n<section class=\"textbox keyTakeaway\">\r\n<div>\r\n<h3>statements and conditionals<\/h3>\r\n<p>A <strong>statement<\/strong> is either true or false.<\/p>\r\n<p>&nbsp;<\/p>\r\n<p>A <strong>conditional<\/strong> is a compound statement of the form: \u201cif [latex]p[\/latex] then [latex]q[\/latex]\u201d or \u00a0\u201cif [latex]p[\/latex] then [latex]q[\/latex], else [latex]s[\/latex] .\u201d<\/p>\r\n<\/div>\r\n<\/section>\r\n<section class=\"textbox example\">In common language, an example of a conditional statement would be \u201cIf it is raining, then we\u2019ll go to the mall. Otherwise we\u2019ll go for a hike. \u201dThe statement \u201cIf it is raining\u201d is the condition\u2014this may be true or false for any given day. If the condition is true, then we will follow the first course of action, and go to the mall. If the condition is false, then we will use the alternative, and go for a hike.<\/section>\r\n<section class=\"textbox tryIt\">[ohm2_question hide_question_numbers=1]7054[\/ohm2_question]<\/section>\r\n<h3>Conditional Statements and Excel<\/h3>\r\n<p>Conditional statements are commonly used in spreadsheet applications like Excel. In Excel, you can enter an expression like:<\/p>\r\n<center>[latex]=\\text{IF}(A1&lt;2000, A1+1, A1*2)[\/latex]<\/center>\r\n<p>Notice that after the IF, there are three parts. The first part is the condition, and the second two are calculations.<\/p>\r\n<p>Excel will look at the value in cell [latex]A1[\/latex] and compare it to [latex]2000[\/latex]. If that condition is true, then the first calculation is used, and [latex]1[\/latex] is added to the value of [latex]A1[\/latex] and the result is stored. If the condition is false, then the second calculation is used, and [latex]A1[\/latex] is multiplied by [latex]2[\/latex] and the result is stored.<\/p>\r\n<p>In other words, this statement is equivalent to saying \u201cIf the value of [latex]A1[\/latex] is less than [latex]2000[\/latex], then add [latex]1[\/latex] to the value in [latex]A1[\/latex]. Otherwise, multiple [latex]A1[\/latex] by [latex]2[\/latex].\u201d<\/p>\r\n<section class=\"textbox example\">Given the Excel expression:\r\n\r\n\r\n<p style=\"text-align: center;\">[latex]\\text{IF}(A1 &gt; 5, 2*A1, 3*A1)[\/latex]<\/p>\r\n<p>Find the following:<\/p>\r\n<ol>\r\n\t<li>the result if [latex]A1[\/latex] is [latex]3[\/latex], and<\/li>\r\n\t<li>the result if [latex]A1[\/latex] is [latex]8[\/latex]<\/li>\r\n<\/ol>\r\n<p>[reveal-answer q=\"488310\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"488310\"]<\/p>\r\n<p>This is equivalent to saying<\/p>\r\n<p style=\"text-align: center;\">If [latex]A1 &gt;5[\/latex], then calculate [latex]2*A1[\/latex]. Otherwise, calculate [latex]3*A1[\/latex]<\/p>\r\n<ol style=\"list-style-type: decimal;\">\r\n\t<li>If [latex]A1[\/latex] is [latex]3[\/latex], then the condition is false, since [latex]3 &gt; 5[\/latex] is not true, so we do the alternate action, and multiple by [latex]3[\/latex], giving [latex]3*3 = 9[\/latex]<\/li>\r\n\t<li>If [latex]A1[\/latex] is [latex]8[\/latex], then the condition is true, since [latex]8 &gt; 5[\/latex], so we multiply the value by [latex]2[\/latex], giving [latex]2*8=16[\/latex]<\/li>\r\n<\/ol>\r\n<p>[\/hidden-answer]<\/p>\r\n<\/section>\r\n<section class=\"textbox tryIt\">[ohm2_question hide_question_numbers=1]7055[\/ohm2_question]<\/section>\r\n<section class=\"textbox recall\">\r\n<p><strong>Re-representing expressions in helpful ways:<\/strong><\/p>\r\n<p>In the example below, you'll need to convert numerical information from a real-world situation into a mathematical model of the situation.<\/p>\r\n<p>Ex. Recall that to identify [latex]15\\%[\/latex] of [latex]$30,000[\/latex] is to multiply [latex]30,000[\/latex] by [latex]0.15[\/latex].<\/p>\r\n<p>First convert the percentage to decimal form by moving the decimal point [latex]2[\/latex] places to the left and dropping the [latex]\\%[\/latex] symbol. Then multiply [latex]30,000 \\cdot 0.15[\/latex].<\/p>\r\n<\/section>\r\n<section class=\"textbox tryIt\">[ohm2_question hide_question_numbers=1]7056[\/ohm2_question]<\/section>\r\n<p>As we did earlier, we can create more complex conditions by using the operators and, or, and not to join simpler conditions together. Let's try a simple example before we apply this to Excel.<\/p>\r\n<section class=\"textbox example\">A parent might say to their child \u201cif you clean your room and take out the garbage, then you can have ice cream.\u201d Under what circumstances will this conditional be true?<br \/>\r\n[reveal-answer q=\"47615\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"47615\"]Here, there are two simpler conditions:\r\n\r\n\r\n<ol>\r\n\t<li>The child cleaning her room<\/li>\r\n\t<li>The child taking out the garbage<\/li>\r\n<\/ol>\r\n<p>Since these conditions were joined with <em>and<\/em>, then the combined conditional will only be true if both simpler conditions are true; if either chore is not completed then the parent\u2019s condition is not met.<\/p>\r\n<p>Notice that if the parent had said \u201cif you clean your room <em>or<\/em> take out the garbage, then you can have ice cream,\u201d then the child would only need to complete one chore to meet the condition.<br \/>\r\n[\/hidden-answer]<\/p>\r\n<\/section>\r\n<p>Suppose you wanted to have something happen when a certain value is between [latex]100[\/latex] and [latex]300[\/latex]. To create the condition \u201c[latex]A1 &lt; 300 \\text{ and } A1 &gt; 100[\/latex]\u201d in Excel, you would need to enter \u201c[latex]\\text{AND}(A1&lt;300, A1&gt;100)[\/latex]\u201d. Likewise, for the condition \u201c[latex]A1=4 \\text{ or } A1=6[\/latex]\u201d you would enter \u201c[latex]\\text{OR}(A1=4, A1=6)[\/latex].\u201d<\/p>\r\n<section class=\"textbox example\">In a spreadsheet, cell [latex]A1[\/latex] contains annual income, and [latex]A2[\/latex] contains number of dependents. A certain tax credit applies if someone with no dependents earns less than [latex]$10,000[\/latex] and has no dependents, or if someone with dependents earns less than [latex]$20,000[\/latex]. Write a rule that describes this.<br \/>\r\n[reveal-answer q=\"488063\"]Show Solution[\/reveal-answer]<br \/>\r\n[hidden-answer a=\"488063\"]There are two ways the rule is met: income is less than [latex]10,000[\/latex] <em>and<\/em> dependents is [latex]0[\/latex], <em>or <\/em>income is less than [latex]20,000[\/latex] <em>and<\/em> dependents is not [latex]0[\/latex]. Informally, we could write these as:<br \/>\r\n<br \/>\r\n<center>[latex](A1 &lt; 10000 \\text{ and } A2 = 0) \\text{ or } (A1 &lt; 20000 \\text{ and } A2 &gt; 0)[\/latex]<br \/>\r\n<br \/><\/center>\r\nNotice that the [latex]A2 &gt; 0[\/latex] condition is actually redundant and not necessary, since we\u2019d only be considering that <em>or<\/em> case if the first pair of conditions were not met. So this could be simplified to:\r\n\r\n<center>\r\n<p>[latex](A1 &lt; 10000 \\text{ and } A2 = 0) \\text{ or } (A1 &lt; 20000)[\/latex]<\/p>\r\n<\/center>\r\n<p>In Excel\u2019s format, we\u2019d write:<\/p>\r\n<center>\r\n<p>[latex]= \\text{IF} ( \\text{OR}( \\text{AND}(A1 &lt; 10000, A2 = 0), A1 &lt; 20000), \\text{\u201cyou qualify\u201d}, \\text{\u201cyou don\u2019t qualify\u201d})[\/latex]<\/p>\r\n<\/center>\r\n<p>[\/hidden-answer]<\/p>\r\n<\/section>","rendered":"<h2>Conditional Statements<\/h2>\n<p>Beyond searching, Boolean logic is commonly used in spreadsheet applications like Excel to do conditional calculations. A <strong>statement<\/strong> is something that is either true or false. A statement like [latex]3 < 5[\/latex] is true; a statement like \u201ca rat is a fish\u201d is false. A statement like \u201c[latex]x < 5[\/latex]\u201d is true for some values of [latex]x[\/latex] and false for others. When an action is taken or not depending on the value of a statement, it forms a <strong>conditional<\/strong>.<\/p>\n<section class=\"textbox keyTakeaway\">\n<div>\n<h3>statements and conditionals<\/h3>\n<p>A <strong>statement<\/strong> is either true or false.<\/p>\n<p>&nbsp;<\/p>\n<p>A <strong>conditional<\/strong> is a compound statement of the form: \u201cif [latex]p[\/latex] then [latex]q[\/latex]\u201d or \u00a0\u201cif [latex]p[\/latex] then [latex]q[\/latex], else [latex]s[\/latex] .\u201d<\/p>\n<\/div>\n<\/section>\n<section class=\"textbox example\">In common language, an example of a conditional statement would be \u201cIf it is raining, then we\u2019ll go to the mall. Otherwise we\u2019ll go for a hike. \u201dThe statement \u201cIf it is raining\u201d is the condition\u2014this may be true or false for any given day. If the condition is true, then we will follow the first course of action, and go to the mall. If the condition is false, then we will use the alternative, and go for a hike.<\/section>\n<section class=\"textbox tryIt\"><iframe loading=\"lazy\" id=\"ohm7054\" class=\"resizable\" src=\"https:\/\/ohm.one.lumenlearning.com\/multiembedq.php?id=7054&theme=lumen&iframe_resize_id=ohm7054&source=tnh\" width=\"100%\" height=\"150\"><\/iframe><\/section>\n<h3>Conditional Statements and Excel<\/h3>\n<p>Conditional statements are commonly used in spreadsheet applications like Excel. In Excel, you can enter an expression like:<\/p>\n<div style=\"text-align: center;\">[latex]=\\text{IF}(A1<2000, A1+1, A1*2)[\/latex]<\/div>\n<p>Notice that after the IF, there are three parts. The first part is the condition, and the second two are calculations.<\/p>\n<p>Excel will look at the value in cell [latex]A1[\/latex] and compare it to [latex]2000[\/latex]. If that condition is true, then the first calculation is used, and [latex]1[\/latex] is added to the value of [latex]A1[\/latex] and the result is stored. If the condition is false, then the second calculation is used, and [latex]A1[\/latex] is multiplied by [latex]2[\/latex] and the result is stored.<\/p>\n<p>In other words, this statement is equivalent to saying \u201cIf the value of [latex]A1[\/latex] is less than [latex]2000[\/latex], then add [latex]1[\/latex] to the value in [latex]A1[\/latex]. Otherwise, multiple [latex]A1[\/latex] by [latex]2[\/latex].\u201d<\/p>\n<section class=\"textbox example\">Given the Excel expression:<\/p>\n<p style=\"text-align: center;\">[latex]\\text{IF}(A1 > 5, 2*A1, 3*A1)[\/latex]<\/p>\n<p>Find the following:<\/p>\n<ol>\n<li>the result if [latex]A1[\/latex] is [latex]3[\/latex], and<\/li>\n<li>the result if [latex]A1[\/latex] is [latex]8[\/latex]<\/li>\n<\/ol>\n<p><div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q488310\">Show Solution<\/button><\/p>\n<div id=\"q488310\" class=\"hidden-answer\" style=\"display: none\">\n<p>This is equivalent to saying<\/p>\n<p style=\"text-align: center;\">If [latex]A1 >5[\/latex], then calculate [latex]2*A1[\/latex]. Otherwise, calculate [latex]3*A1[\/latex]<\/p>\n<ol style=\"list-style-type: decimal;\">\n<li>If [latex]A1[\/latex] is [latex]3[\/latex], then the condition is false, since [latex]3 > 5[\/latex] is not true, so we do the alternate action, and multiple by [latex]3[\/latex], giving [latex]3*3 = 9[\/latex]<\/li>\n<li>If [latex]A1[\/latex] is [latex]8[\/latex], then the condition is true, since [latex]8 > 5[\/latex], so we multiply the value by [latex]2[\/latex], giving [latex]2*8=16[\/latex]<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"textbox tryIt\"><iframe loading=\"lazy\" id=\"ohm7055\" class=\"resizable\" src=\"https:\/\/ohm.one.lumenlearning.com\/multiembedq.php?id=7055&theme=lumen&iframe_resize_id=ohm7055&source=tnh\" width=\"100%\" height=\"150\"><\/iframe><\/section>\n<section class=\"textbox recall\">\n<p><strong>Re-representing expressions in helpful ways:<\/strong><\/p>\n<p>In the example below, you&#8217;ll need to convert numerical information from a real-world situation into a mathematical model of the situation.<\/p>\n<p>Ex. Recall that to identify [latex]15\\%[\/latex] of [latex]$30,000[\/latex] is to multiply [latex]30,000[\/latex] by [latex]0.15[\/latex].<\/p>\n<p>First convert the percentage to decimal form by moving the decimal point [latex]2[\/latex] places to the left and dropping the [latex]\\%[\/latex] symbol. Then multiply [latex]30,000 \\cdot 0.15[\/latex].<\/p>\n<\/section>\n<section class=\"textbox tryIt\"><iframe loading=\"lazy\" id=\"ohm7056\" class=\"resizable\" src=\"https:\/\/ohm.one.lumenlearning.com\/multiembedq.php?id=7056&theme=lumen&iframe_resize_id=ohm7056&source=tnh\" width=\"100%\" height=\"150\"><\/iframe><\/section>\n<p>As we did earlier, we can create more complex conditions by using the operators and, or, and not to join simpler conditions together. Let&#8217;s try a simple example before we apply this to Excel.<\/p>\n<section class=\"textbox example\">A parent might say to their child \u201cif you clean your room and take out the garbage, then you can have ice cream.\u201d Under what circumstances will this conditional be true?<\/p>\n<div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q47615\">Show Solution<\/button><\/p>\n<div id=\"q47615\" class=\"hidden-answer\" style=\"display: none\">Here, there are two simpler conditions:<\/p>\n<ol>\n<li>The child cleaning her room<\/li>\n<li>The child taking out the garbage<\/li>\n<\/ol>\n<p>Since these conditions were joined with <em>and<\/em>, then the combined conditional will only be true if both simpler conditions are true; if either chore is not completed then the parent\u2019s condition is not met.<\/p>\n<p>Notice that if the parent had said \u201cif you clean your room <em>or<\/em> take out the garbage, then you can have ice cream,\u201d then the child would only need to complete one chore to meet the condition.\n<\/div>\n<\/div>\n<\/section>\n<p>Suppose you wanted to have something happen when a certain value is between [latex]100[\/latex] and [latex]300[\/latex]. To create the condition \u201c[latex]A1 < 300 \\text{ and } A1 > 100[\/latex]\u201d in Excel, you would need to enter \u201c[latex]\\text{AND}(A1<300, A1>100)[\/latex]\u201d. Likewise, for the condition \u201c[latex]A1=4 \\text{ or } A1=6[\/latex]\u201d you would enter \u201c[latex]\\text{OR}(A1=4, A1=6)[\/latex].\u201d<\/p>\n<section class=\"textbox example\">In a spreadsheet, cell [latex]A1[\/latex] contains annual income, and [latex]A2[\/latex] contains number of dependents. A certain tax credit applies if someone with no dependents earns less than [latex]$10,000[\/latex] and has no dependents, or if someone with dependents earns less than [latex]$20,000[\/latex]. Write a rule that describes this.<\/p>\n<div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q488063\">Show Solution<\/button><\/p>\n<div id=\"q488063\" class=\"hidden-answer\" style=\"display: none\">There are two ways the rule is met: income is less than [latex]10,000[\/latex] <em>and<\/em> dependents is [latex]0[\/latex], <em>or <\/em>income is less than [latex]20,000[\/latex] <em>and<\/em> dependents is not [latex]0[\/latex]. Informally, we could write these as:<\/p>\n<div style=\"text-align: center;\">[latex](A1 < 10000 \\text{ and } A2 = 0) \\text{ or } (A1 < 20000 \\text{ and } A2 > 0)[\/latex]<\/p>\n<\/div>\n<p>Notice that the [latex]A2 > 0[\/latex] condition is actually redundant and not necessary, since we\u2019d only be considering that <em>or<\/em> case if the first pair of conditions were not met. So this could be simplified to:<\/p>\n<div style=\"text-align: center;\">\n[latex](A1 < 10000 \\text{ and } A2 = 0) \\text{ or } (A1 < 20000)[\/latex]\n<\/div>\n<p>In Excel\u2019s format, we\u2019d write:<\/p>\n<div style=\"text-align: center;\">\n[latex]= \\text{IF} ( \\text{OR}( \\text{AND}(A1 < 10000, A2 = 0), A1 < 20000), \\text{\u201cyou qualify\u201d}, \\text{\u201cyou don\u2019t qualify\u201d})[\/latex]\n<\/div>\n<\/div>\n<\/div>\n<\/section>\n","protected":false},"author":15,"menu_order":12,"template":"","meta":{"_candela_citation":"[]","pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"part":24,"module-header":"learn_it","content_attributions":[],"internal_book_links":[],"video_content":null,"cc_video_embed_content":{"cc_scripts":"","media_targets":[]},"try_it_collection":null,"_links":{"self":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters\/3295"}],"collection":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/users\/15"}],"version-history":[{"count":39,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters\/3295\/revisions"}],"predecessor-version":[{"id":15064,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters\/3295\/revisions\/15064"}],"part":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/parts\/24"}],"metadata":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapters\/3295\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/media?parent=3295"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/pressbooks\/v2\/chapter-type?post=3295"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/contributor?post=3295"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/quantitativereasoning\/wp-json\/wp\/v2\/license?post=3295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}