Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

106 lines (83 sloc) 4.196 kB
<!DOCTYPE html>
<html data-require="math graphie">
<head>
<title>Square roots of perfect squares</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="cx">0</var>
<var id="y">0</var>
<var id="N">randRange( 2, 12 )</var>
<var id="F_N">getPrimeFactorization( N )</var>
</div>
<div class="hints">
<p>
If you can't think of that number, you can break down <code><var>Q</var></code> into
its prime factorization and look for equal groups of numbers.
</p>
<div>
<p>Let's draw a factor tree.</p>
<div class="graphie" id="factor-tree">
init({
range: [ [-1, FACTORIZATION.length + 2], [ -2 * FACTORIZATION.length - 1, 1] ],
scale: [30, 30]
});
label( [cx + 1, y], curr );
</div>
</div>
<div class="graphie" data-each="FACTORIZATION as factor" data-update="factor-tree">
path( [ [cx + 1, y - 0.5], [cx, y - 1.5] ] );
path( [ [cx + 1, y - 0.5], [cx + 2, y - 1.5] ] );
y -= 2;
cx += 1;
curr = curr / factor;
label( [cx - 1, y], factor );
circle( [cx - 1, y], 0.5);
label( [cx + 1, y], curr );
</div>
<div class="graphie" data-update="factor-tree">
circle( [cx + 1, y], 0.5);
</div>
<p>So the prime factorization of <code><var>Q</var></code> is <code><var>PRIMES.join( "\\times " )</var></code>.</p>
</div>
<div class="problems">
<div id="square">
<div class="vars">
<var id="Q">N * N</var>
<var id="PRIMES">getPrimeFactorization( Q )</var>
<var id="FACTORIZATION">PRIMES.slice( 0, PRIMES.length - 1 )</var>
<var id="curr">Q</var>
</div>
<p class="question"><code>\Large{\sqrt{<var>Q</var>} = \text{?}}</code></p>
<p class="solution" data-forms="integer"><var>N</var></p>
<div class="hints" data-apply="prependContents">
<p>
<code>\sqrt{<var>Q</var>}</code> is the number that, when
multiplied by itself, equals <code><var>Q</var></code>.
</p>
</div>
<div class="hints" data-apply="appendContents">
<p>We're looking for <code>\sqrt{<var>Q</var>}</code>, so we want to split the prime factors into two identical groups.</p>
<div data-if="PRIMES.length === 2" data-unwrap="">
<p>We only have two prime factors, and we want to split them into two groups, so this is easy.</p>
<p><code><var>Q</var> = <var>PRIMES.join( "\\times " )</var></code>, so <code><var>N</var>^2 = <var>Q</var></code>.</p>
</div><div data-else="" data-unwrap="">
<div>
<p>Notice that we can rearrange the factors like so:</p>
<p><code><var>Q</var> = <var>PRIMES.join(" \\times ")</var> = \left(<var>F_N.join( "\\times " )</var>\right) \times \left(<var>F_N.join(" \\times ")</var>\right)</code></p>
</div>
<p data-if="F_N.length > 1">
So <code>\left(<var>F_N.join( "\\times " )</var>\right)^2 = <var>N</var>^2 = <var>Q</var></code>.
</p><p data-else="">
So <code><var>N</var>^2 = <var>Q</var></code>.
</p>
</div>
<p>So <code>\sqrt{<var>Q</var>}</code> is <code><var>N</var></code>.</p>
</div>
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.