Show that the following function is harmonic [Solved] I am trying to show that the function:
$$u(x)=|x|^{(2-n)}$$
is harmonic where $x$ is a vector in $\mathbb{R}^n\setminus\{0\}$
Here is what I tried:
$\displaystyle u(x)=|x|^{(2-n)}$ 
$\displaystyle $$\frac{\partial u(x)}{\partial x_{i}}=x_{i}(2-n) |x|^{(1-n)}$, where here we are differentiating with respect to $\displaystyle x_{i}$, the $i$th value of the vector $x$.
$\displaystyle $$\frac{\partial^{2} u(x)}{\partial x_{i}^{2}}=(2-n) |x|^{(1-n)}+x_{i}^2(2-n)(1-n) |x|^{-n}$
$\Delta u=\sum_{j=1}^{n} $$\frac{\partial^{2} u(x)}{\partial x_{i}^{2}}=n(2-n) |x|^{(1-n)}+(2-n)(1-n) |x|^{2-n}$
From here, I can't see how to get this equal to zero or where I've gone wrong. Thanks.
 A: There is already an error in your calculation of the first partial 
derivative.
The derivative of $ \lvert x\rvert = \sqrt{x_1^2 + \ldots + x_n^2}$ with respect to $x_i$ is
$$
   \frac {2 x_i}{2 \sqrt{x_1^2 + \ldots + x_n^2}} = \frac {x_i}{\lvert x \rvert}
$$
for  $x \ne 0$, and therefore 
$$
\frac{\partial u(x)}{\partial x_{i}} = (2-n) \, \lvert x \rvert^{(1-n)} \, \frac {x_i}{\lvert x \rvert}
= (2-n) \, x_i \, \lvert x \rvert ^{-n} \quad .
$$
From there you should get the expected result.
A: I realize this problem is "solved", and so be it; lauds to Martin R for his nice detective work leading the the discovery of Vladimir's error and the subsequent resolution.
Having said these things, I can't help but point out that this problem has an elegant solution based upon the observation that
$u(x) = \vert x \vert^{2 - n} \tag{1}$
is really a function of 
$r = \vert x \vert = \sqrt{\sum_1^n x_i^2}; \tag{2}$
writing then
$u(r) = r^{2 - n} \tag{3}$
we may proceed to evaluate $\nabla^2 u(r)$ in generalized spherical coordinates on $\Bbb R^n \setminus \{0\}$.  We have, for any function $\Theta(r)$ of $r$ alone
$\nabla^2 \Theta(r) = \nabla \cdot (\nabla \Theta(r)); \tag{4}$
now
$\nabla \Theta(r) = \dfrac{\partial \Theta(r)}{\partial r} \nabla r, \tag{5}$
a standard formula for the gradient operator: $\nabla (f(g)) = (\partial f / \partial g)\nabla g$, as may be easily verified using the chain rule in the $x_i$ coordinate system;
here $g$ is a function from (an open set of) $\Bbb R^n$ to $\Bbb R$ and $f:\text{Range}(g) \to \Bbb R$.  Using (2) we also see that the components of $\nabla r$ satisfy
$(\nabla r)_i = r^{-1}x_i, \tag{6}$
so that 
$\nabla r = r^{-1} \vec r, \tag{7}$
where
$\vec r = (x_1, x_2, \ldots, x_n). \tag{8}$
Now (4), (5) and (7) yield
$\nabla^2 \Theta(r) = \nabla \cdot \nabla \Theta(r) = \nabla \cdot (\dfrac{\partial \Theta(r)}{\partial r} \nabla r) = \nabla(\dfrac{\partial \Theta(r)}{\partial r}) \cdot \nabla r + \dfrac{\partial \Theta(r)}{\partial r} \nabla \cdot \nabla r$
$= \nabla(\dfrac{\partial \Theta(r)}{\partial r}) \cdot \nabla r + \dfrac{\partial \Theta(r)}{\partial r} \nabla \cdot (r^{-1} \vec r), \tag{9}$
where we have used the well-known formula
$\nabla \cdot (g \vec X) = \nabla f \cdot \vec X + f \nabla \cdot \vec X, \tag{10}$
holding for (sufficintly differentiable) real functions $f$ and vector fields $\vec X$, more on which may be found in this wikipedia entry.  Inspecting the right-hand side of (9), we see we may apply (10) again to
$\nabla \cdot (r^{-1} \vec r) = \nabla r^{-1} \cdot \vec r + r^{-1} \nabla \cdot \vec r; \tag{11}$
but by (7)
$\nabla r^{-1} \cdot \vec r = -r^{-2}\nabla r \cdot \vec r = -r^{-2} (r^{-1} \vec r) \cdot \vec r = -r^{-3}\vec r \cdot \vec r = -r^{-3}r^2 = -r^{-1}, \tag{12}$
whilst from (8)
$\nabla \cdot \vec r = \sum_1^n \dfrac{\partial x_i}{\partial x_i} = n, \tag{13}$
whence (11) becomes
$\nabla \cdot (r^{-1} \vec r) = - r^{-1} + n r^{-1} = (n - 1)r^{-1}. \tag{14}$
Now $(\partial \Theta(r) /\partial r)$ also depends only on $r$, and so we have, in a manner completely analogous to (5),
$\nabla(\dfrac{\partial \Theta(r)}{\partial r}) \cdot \nabla r = \dfrac{d^2 \Theta(r)}{dr^2} \nabla r \cdot \nabla r= \dfrac{d^2 \Theta(r)}{dr^2}(r^{-1} \vec r) \cdot (r^{-1} \vec r) = \dfrac{d^2 \Theta(r)}{dr^2}, \tag{15}$
since
$(r^{-1} \vec r) \cdot (r^{-1} \vec r) = r^{-2}r^2 = 1. \tag{16}$
Bringing these partial results together yields
$\nabla^2 \Theta(r) = \dfrac{d^2 \Theta(r)}{d^2 r} + \dfrac{n - 1}{r} \dfrac{d \Theta(r)}{dr}, \tag{17}$
and finally, setting $\Theta(r) = u(r) = r^{2 - n}$, we see that
$\Theta^\prime(r) = (2 - n) r^{1 - n}, \tag{18}$
$\Theta^{\prime \prime}(r) = (2 - n)(1 - n)r^{-n}; \tag{19}$
inserting (18), (19) into (17) we see that $\nabla^2 u(r) = 0$, as was to be shown.
Some Final Remarks:  I have attempted, in the preceding discussion, to work in terms of general, coordinate-independent vector identities such as (10), as opposed to executing the calculations from scratch (i.e., directly from the definitions) in a particular set of coordinates such as $x_1, x_2, \ldots, x_n$.  I personally feel this is a simpler way to do things, although the fact that my answer incorporates 19 (tagged) equations whereas Martin R manged to get by using only 2 might cause one to question my judgement in this matter.  But if all the steps implicit in Martin R's answer were written out explicitly, his argument might well prove to be as long as mine.  I also tried to stress spherical symmetry, working as much as possible in terms of the variable $r$ alone; indeed, (17) is really an expression for the Laplacian applied to a spherically symmetric function $\Theta(r)$, and from this the demonstration that $u(r) = r^{2 - n}$ is harmonic readily follows.  I find these techniques, coordinate invariance and the exploitation of symmetry, intriguing and wanted to present a different view of things.  End of Remarks.
Hope this helps.  Cheers,
and as always,
Fiat Lux!!!
