Tuesday, September 16, 2014

Every square matrix is the sum of a unique symmetric and a unique skew-symmetric matrix

This one is going to be alone brief post. Came across this interesting property in my advanced solids course, as well.

Consider the square matrix $\mathbf{A}$. Clearly we can write $\mathbf{A}$ like this $$\begin{align*} \mathbf{A}&=\frac{1}{2}\left(\mathbf{A}+\mathbf{A}+\mathbf{A}^T-\mathbf{A}^T\right)\\ &=\frac{1}{2}\left(\mathbf{A}+\mathbf{A}^T\right)+\frac{1}{2}\left(\mathbf{A}-\mathbf{A}^T\right) \end{align*}$$ Let $\mathbf{B}=\frac{1}{2}(\mathbf{A}+\mathbf{A}^T)$ and $\mathbf{C}=\frac{1}{2}(\mathbf{A}-\mathbf{A}^T)$. So $\mathbf{A}=\mathbf{B}+\mathbf{C}$. Based on the property that $(\mathbf{A}+\mathbf{B})^T=\mathbf{A}^T+\mathbf{B}^T$ it's easy to verify that $\mathbf{B}$ is symmetric $(\mathbf{B}=\mathbf{B}^T)$ and that $\mathbf{C}$ is skew-symmetric $(\mathbf{C}=-\mathbf{C}^T)$. Therefore a solution exists.

But, is this solution unique? Assume we have two solutions: $\mathbf{A}=\mathbf{B}_1+\mathbf{C}_1=\mathbf{B}_2+\mathbf{C}_2$ where $\mathbf{B}_i$ is symmetric and $\mathbf{C}_i$ is skew-symmetric. Since $\mathbf{B}_1+\mathbf{C}_1=\mathbf{B}_2+\mathbf{C}_2$ we know that $$\mathbf{B}_1-\mathbf{B}_2=\mathbf{C}_2-\mathbf{C}_1$$ It's easy to show that the sum of two symmetric matrices is symmetric and the sum of two skew-symmetric matrices is skew-symmetric. Therefore, the left hand side is symmetric and the right hand size is skew-symmetric. Because they are equal, it implies that they are both the zero matrix. $$\mathbf{B}_1-\mathbf{B}_2=\mathbf{C}_2-\mathbf{C}_1=\mathbf{0}$$ And lastly, we see that $$\mathbf{B}_1=\mathbf{B}_2$$ $$\mathbf{C}_1=\mathbf{C}_2$$ And really, we were looking at the same representation. Therefore, it is unique!

In the course we were really talking about how the displacement gradient $\left(\nabla\mathbf{u}\right)$ is really the sum of the infinitesimal strain tensor $\left(\mathbf{\varepsilon}\right)$ that is symmetric and the infinitesimal rotation tensor $\left(\mathbf{\omega}\right)$ that is skew-symmetric. But the same principle applies to the much easier concept of matrices.

Wednesday, September 10, 2014

Temperature Distribution in a Semi-Infinite Wall

Any introductory heat transfer class solves for temperature distributions in plates, solids, etc.. The temperature distribution is a solution to the heat diffusion partial differential equation. The general form of the heat diffusion equation with no internal heat generation in Cartesian coordinates is $$\frac{\partial^2 T}{\partial x^2} + \frac{\partial^2 T}{\partial y^2} + \frac{\partial^2 T}{\partial z^2} = \frac{1}{\alpha}\frac{\partial T}{\partial t}$$ The first series of problems typically tackled in the intro classes are the steady-state solutions. These are the cases where $\partial T / \partial t = 0$. And the very first problems even restrict us to only one dimension. Slowly we add in dimensions and time dependence. However, one problem that I find particularly interesting is the semi-infinite wall. The problem involves a half-space that represents a wall. A very thick wall. One might call it "infinite". So thick that the back end of the wall never receives any heat in the time span that we are concerned with. Therefore, we approximate it as an infinitely thick wall. Additionally, we will assume the wall's area is very large (or that it's boundary is so far away from the area that we're concerned with) and therefore the face of the wall is infinite. And due to symmetry, we can restrict the problem to be in only 1 space dimension: perpendicular to the face of the wall. Our partial differential equations can be reduced to $$\frac{\partial^2 T}{\partial x^2}=\frac{1}{\alpha}\frac{\partial T}{\partial t}$$ This is second order in position and first order in time. Therefore we require two boundary conditions and an initial condition. The initial condition is simple: we will assume that the wall starts off uniform in temperature. $$T(x,0)=T_0$$ Next we have to come up with the boundary conditions. In heat transfer there are three primary surface conditions: constant temperature, constant flux, and convection. The choice of surface condition depends on the physical context that you want to model. However, for the purpose of this solution we will assume that the surface condition has a constant temperature. Meaning that after $t=0$ we instantly change the temperature of the face of the wall to $$T(0,t)=T_s$$ Assuming either of the other two surface conditions changes very little, but requires us to introduce new constants and more complex algebra. As for the last boundary condition, we have already hinted at its nature: the wall at infinity is the same as it is at time $0$. $$T(x\to\infty,t)=T_0$$ But now we have to solve the PDE. But what if we don't know how to solve PDEs? This is what I find fascinating about this problem; we can turn this PDE of two variables into an ODE of 1 variable with a similarity variable [1] $$\eta=\frac{x}{\sqrt{4\alpha t}}$$ We now try to get $\frac{\partial^2 T}{\partial x^2}$ and $\frac{\partial T}{\partial t}$ which are in terms of $T,x,t$ into terms of just $T$ and $\eta$. $$\begin{align*}\frac{\partial^2 T}{\partial x^2}&=\frac{\partial}{\partial x}\left(\frac{\partial T}{\partial x}\right)=\frac{\partial}{\partial x}\left(\frac{\partial T}{\partial \eta}\frac{\partial \eta}{\partial x}\right)=\frac{\partial}{\partial x}\left(\frac{\partial T}{\partial \eta}\frac{1}{\sqrt{4\alpha t}}\right)\\ &=\frac{1}{\sqrt{4\alpha t}}\frac{\partial}{\partial x}\left(\frac{\partial T}{\partial \eta}\right)=\frac{1}{\sqrt{4\alpha t}}\left(\frac{\partial^2 T}{\partial x\partial \eta}\right)=\frac{1}{\sqrt{4\alpha t}}\left(\frac{\partial^2 T}{\partial \eta\partial x}\right)\\ &=\frac{1}{\sqrt{4\alpha t}}\frac{\partial}{\partial \eta}\left(\frac{\partial T}{\partial x}\right)=\frac{1}{\sqrt{4\alpha t}}\frac{\partial}{\partial \eta}\left(\frac{\partial T}{\partial \eta}\frac{\partial \eta}{\partial x}\right)\\ &=\frac{1}{\sqrt{4\alpha t}}\frac{\partial}{\partial \eta}\left(\frac{\partial T}{\partial \eta}\frac{1}{\sqrt{4\alpha t}}\right)=\frac{1}{4\alpha t}\frac{\partial^2 T}{\partial \eta^2} \end{align*}$$ The above depends on the continuity of $T$ and the independence of $x$ and $t$. Both are very appropriate assumptions for our problem. Likewise we can show $$\frac{\partial T}{\partial t}=\frac{\partial T}{\partial \eta}\frac{\partial \eta}{\partial t}=-\frac{x}{2t\sqrt{4\alpha t}}\frac{\partial T}{\partial \eta}$$ Putting these back into our heat equation $$\frac{1}{4\alpha t}\frac{\partial^2 T}{\partial \eta^2}=-\frac{1}{\alpha}\frac{x}{2t\sqrt{4\alpha t}}\frac{\partial T}{\partial \eta}$$ which can simplify to $$\begin{align*} \frac{\partial^2 T}{\partial \eta^2}&=-\frac{x\sqrt{4\alpha t}}{2\alpha t}\frac{\partial T}{\partial \eta}=-\frac{x}{x}\frac{x\sqrt{4\alpha t}}{2\alpha t}\frac{\partial T}{\partial \eta}=-2\frac{\sqrt{4\alpha t}}{x}\frac{x^2}{4\alpha t}\frac{\partial T}{\partial \eta}\\ &=-2\frac{x}{\sqrt{4\alpha t}}\frac{\partial T}{\partial \eta}=-2\eta\frac{\partial T}{\partial \eta} \end{align*}$$ And since it's all in terms of $\eta$ we can turn the partials back into total derivatives $$\frac{\mathrm{d}^2 T}{\mathrm{d} \eta^2}=-2\eta\frac{\mathrm{d}T}{\mathrm{d}\eta}$$ Now we are left to convert our boundary conditions into $\eta$. Our surface boundary condition, the condition where $x=0$ clearly corresponds to the case where $\eta=0$ and therefore $T(0)=T_s$. And the two conditions, $t=0$ and $x\to\infty$ clearly corresponds to the case where $\eta\to\infty$. Therefore, $T(\eta\to\infty)=T_0$. Thus the three conditions on the PDE are now two conditions in the ODE. I'm not going to solve this ODE because it's a standard separation of variables solution. I was only interested in sharing the conversion from the PDE of two variables into the ODE of one variable. I will however, spoil the ending and share the solution: $$ \DeclareMathOperator\erf{erf} \frac{T(\eta)-T_s}{T_0-T_s}=\erf{\eta}$$ where $\erf{\eta}$ is the error function (Go figure!). However, we can always substitute back in $x$ and $t$ because $T(\eta)=T(x,t)$. Therefore, in conclusion $$\frac{T(x,t)-T_s}{T_0-T_s}=\erf{\left(\frac{x}{\sqrt{2\alpha t}}\right)}$$

[1] Incropera, Frank P. Fundamentals of Heat and Mass Transfer. Hoboken, NJ: Wiley, 2013. Print.

Friday, September 5, 2014

Alternative Definition for a Skew-Symmetric Matrix

I was working on some advanced solid mechanics homework and a problem asked to prove a particular identity for $2^{\text{nd}}$ order tensors. I really enjoyed the solution that I came up with. It's the type of proof that goes
Suppose some statement $A$ is true for all $x$. We want to show that statement $B$ is true. Consider the very special case where $x=(\text{randomnesspulled}$ $\text{outofthinairbutmakestheproblemverysimple})$... and the proof goes on very smoothly because of that particular choice of $x$.
Well, I finally managed to come up with one of those proofs! I believe that book only intended for the problem to be solved for the 3-dimensional case where writing out the explicit possibilities is very feasible and most likely the expected solution. I will share my (arguably prettier) solution. But I will translate it into terms of linear algebra, matrices, and vectors instead of tensors. But first some background.

Definition 1. A skew-symmetric matrix is a matrix $\mathbf{A}$ such that $\mathbf{A}=-\mathbf{A}^T$.

Where $^T$ denotes the transpose operator (i.e. flip along the main diagonal). We will use the notation $A_{ij}$ to denote the element of $\mathbf{A}$ in the $i^{\text{th}}$ row and $j^{\text{th}}$ column. Therefore, this definition can be written as $$A_{ij}=-A_{ji}$$ Here are a few examples of skew symmetric matrices: $$\left[\begin{matrix}0&1&1\\ -1&0&1\\ -1&-1&0\end{matrix}\right] \quad\left[\begin{matrix}0&1&-2&3\\ -1&0&-4&5\\ 2&4&0&6\\ -3&-5&-6&0\end{matrix}\right] \quad\left[\begin{matrix}0&a\\ -a&0\end{matrix}\right]$$ Note that all have $0$'s down the main diagonal because $0$ is the only number that solves $x=-x$. Now, the alternative definition to this type of matrix is:

Definition 2. For all vectors $\mathbf{u}$, $\mathbf{A}$ is skew-symmetric if $\mathbf{u}^T\mathbf{Au}=0$.

And to show that this definition is the same as the previous one, all we need to do it show the following theorem. Which is the problem in the book but in terms of matrices and vectors and not tensors (maybe another day!).

Theorem 1. For all vectors $\mathbf{u}$, $\mathbf{u}^T\mathbf{Au}=0$ if and only if $A_{ij}=-A_{ji}$.

Proof.
$(\Leftarrow)$ Assume that $A_{ij}=-A_{ji}$. We want to show that for all $\mathbf{u}$, $\mathbf{u}^T\mathbf{Au}=0$. Consider $\mathbf{u}^T\mathbf{Au}$. It can be shown that $$\mathbf{u}^T\mathbf{Au}=\sum_{i=1}^n\sum_{j=1}^nA_{ij}u_iu_j$$ where the vectors are of length $n$ and the matrix is of size $n\times n$. And since $A_{ij}=-A_{ji}$, we know that $$\sum_{i=1}^n\sum_{j=1}^nA_{ij}u_iu_j=\sum_{i=1}^n\sum_{j=1}^n-A_{ji}u_iu_j$$ But $i$ and $j$ are just dummy variable names and we can swap them, as long as we swap all of them. So: $$\sum_{i=1}^n\sum_{j=1}^nA_{ij}u_iu_j=\sum_{j=1}^n\sum_{i=1}^n-A_{ij}u_ju_i$$ But summation order doesn't matter, multiplication is commutative, and we can pull the negative out. $$\left(\sum_{i=1}^n\sum_{j=1}^nA_{ij}u_iu_j\right)=-\left(\sum_{i=1}^n\sum_{j=1}^nA_{ij}u_iu_j\right)$$ And, as stated above, the only solution to $x=-x$ is $0$. Thus $\mathbf{u}^T\mathbf{Au}=0$. That was the easy direction. Now for the fun one!
$(\Rightarrow)$ Assume $\mathbf{u}^T\mathbf{Au}=0$ for all $\mathbf{u}$. We want to show that $A_{ij}=-A_{ji}$. Going back to the summations we have $$\mathbf{u}^T\mathbf{Au}=\sum_{i=1}^n\sum_{j=1}^nA_{ij}u_iu_j=0$$ Now, consider the vectors $\mathbf{u}^{(r,s)}$ such that $u_i=\delta_{ri}+\delta_{si}$ where $\delta_{ij}$ is the Kronecker delta function. $$\delta_{ij}=\begin{cases}1&i=j\\ 0&i\ne j\end{cases}$$ Some examples of these vectors are $$\begin{align*} \mathbf{u}^{(1,1)}=\left[2,0,0\right]\\ \mathbf{u}^{(2,1)}=\left[1,1,0\right]\\ \mathbf{u}^{(3,1)}=\left[1,0,1\right] \end{align*}$$ Those were all examples in three dimensions, however, these can be in any number of dimensions. For instance this ten dimensional version $$\mathbf{u}^{(4,7)}=\left[0,0,0,1,0,0,1,0,0,0\right]$$ Basically, if $r=s$, then the vector has all zero components with the exception of the $r^{\text{th}}$ component which is $1+1=2$. Or if $r\ne s$ then the vector still has all zero components with the exception of the $r^{\text{th}}$ component which is $1+0=1$ and the $s^{\text{th}}$ component which is $0+1=1$.

Consider first, the case where $r=s$. We know that $u_i^{(r,r)}=2\delta_{ri}$ and thus $$0=\sum_{i=1}^n\sum_{j=1}^nA_{ij}u_iu_j=\sum_{i=1}^n\sum_{j=1}^nA_{ij}(2\delta_{ri})(2\delta_{rj})$$ Since $\delta_{ri}$ and $\delta_{rj}$ are zero unless $i=r$ and $j=r$, we can drop the summation and just use $i=j=r$ and the deltas become multiplications by $1$. $$0=A_{rr}(2)(1)(2)(1)=4A_{rr}$$ Thus $A_{ii}=0$ and we have zeros down the main diagonal. Step in the right direction!

Now consider the case where $r\ne s$. We know that $u_i^{(r,s)}=\delta_{ri}+\delta_{si}$. Thus $$0=\sum_{i=1}^n\sum_{j=1}^nA_{ij}u_iu_j=\sum_{i=1}^n\sum_{j=1}^nA_{ij}(\delta_{ri}+\delta_{si})(\delta_{rj}+\delta_{sj})$$ We can foil and distribute and get $$0=\sum_{i=1}^n\sum_{j=1}^n\left(A_{ij}\delta_{ri}\delta_{rj}+A_{ij}\delta_{ri}\delta_{sj}+A_{ij}\delta_{si}\delta_{rj}+A_{ij}\delta_{si}\delta_{sj}\right)$$ The summand is only non-zero for four cases: $(r=i=j)$, $(r=i,s=j)$, $(s=i,r=j)$, $(s=i=j)$. If one of these isn't true, then the summand is $0+0+0+0=0$. Thus, we can take just the four terms with those $i$ and $j$ values and drop the summation. $$\begin{align*} 0=&\left(A_{rr}\delta_{rr}\delta_{rr}+A_{rr}\delta_{rr}\delta_{sr}+A_{rr}\delta_{sr}\delta_{rr}+A_{rr}\delta_{sr}\delta_{sr}\right)+\\ &\left(A_{rs}\delta_{rr}\delta_{rs}+A_{rs}\delta_{rr}\delta_{ss}+A_{rs}\delta_{sr}\delta_{rs}+A_{rs}\delta_{sr}\delta_{ss}\right)+\\ &\left(A_{sr}\delta_{rs}\delta_{rr}+A_{sr}\delta_{rs}\delta_{sr}+A_{sr}\delta_{ss}\delta_{rr}+A_{sr}\delta_{ss}\delta_{sr}\right)+\\ &\left(A_{ss}\delta_{rs}\delta_{rs}+A_{ss}\delta_{rs}\delta_{ss}+A_{ss}\delta_{ss}\delta_{rs}+A_{ss}\delta_{ss}\delta_{ss}\right) \end{align*}$$ Now remember that $A_{ii}=0$ so the first and last lines are all $0$. And we can cross out any term with a $\delta_{rs}$ or $\delta_{sr}$. And we can replace any $\delta_{rr}$ or $\delta_{ss}$ with a multiplication by $1$. This leaves us with $$0=A_{rs}+A_{sr}$$ And this implies that $A_{ij}=-A_{ji}$.

I will say that this was both simpler and much prettier in Einstein tensor notation. But with the choice of $\mathbf{u}$ we had all but $4$ of $n^2$ terms cancel out in one step and the $14$ of $16$ terms cancel out in the second step. The remainder of the proof was easy!