title: Calculating Partitioned Matrices from subs
body: <p>Say you have a matrix A which is of size P &#215; P and a number Q &lt; P can be used to
  take a partition of said matrix, where:</p>
  
  <ul>
  <li>A<sub>1</sub> is the upper-left sub matrix, with dimension Q &#215; Q,</li>
  <li>A<sub>2</sub> is the upper-right sub matrix, with dimension Q &#215; (P-Q),</li>
  <li>A<sub>3</sub> is the lower-left sub matrix, with dimension (P-Q) &#215; Q,</li>
  <li>A<sub>4</sub> is the lower-rightsub matrix, with dimension (P-Q) &#215; (P-Q).</li>
  </ul>
  
  <p>Which looks like this: </p>
  
  <pre><code>      A1 | A2
  A =   ---+----
        A3 | A4
  </code></pre>
  
  <p>How can you calculate the matrix:</p>
  
  <p><img src="https://i.stack.imgur.com/ET4Sm.jpg" alt="Matrix B"></p>
  
  <p>Where 0<sub>q</sub> is a Q &#215; Q matrix with zero elements. </p>
  
  <p>I'm learning from a book called "Discovering Statistics using R" and although it discusses partitioned matrices, it doesn't show how to calculate one like the one given above and unfortunately I'm having no luck on the programming or maths based searches...</p>
  
  <p>Any help, either mathematically and/or example R code would be great. Thanks in advance.</p>