# Getting g such that del dot g = f (given)

1. Apr 10, 2009

### quantoshake11

Hi, it's not quite a homework question, altought this question came up to mind when i was trying to solve a homework problem. sorry if this shouldn't be here...
The thing is this, what are the conditions i should impose to f: R^n -> R in order to be able to find a g, such that [divergence of g = f] ?
I'm not sure how to handle this, since it seems to involve some sort of differential equation (does it?) or at least the existence of an integral for f.. well, i don't really need to get the g, i just need to know if it exists to solve this problem the way i want to, which is to transform a volume integral into a surface integral (why would somebody want a divergence if not? :P)
thanks, and mods: please move the post if this belongs to the homework category..

2. Apr 10, 2009

### slider142

Unfortunately, there is no unique g satisfying that equation. Ie., suppose f(x, y, z) = x + y + z.

Then g1(x, y, z) = (z + C1, z + C2, z(x + y) + z2/2 + C3) and g2(x, y, z) = (x2/2 + D1, y2/2 + D2, z2/2 + D3) both satisfy the equation, but are not equivalent.

Last edited: Apr 10, 2009
3. Apr 10, 2009

### quantoshake11

well, as i said i only need to prove the existence of such a function (at least one)

4. Apr 10, 2009

### AUMathTutor

Wouldn't this work?

Let all components of g equal zero, except for the first component, where the first component is any antiderivative of f with respect to the variable corresponding to the first component, taking the other variables as constants?

EXAMPLE:

f(x,y,z) = x + 2y + zexp(z)

g = ( (1/2)x^2 + x(2y + zexp(z)) + C, 0, 0)

The the divergence of g is:

x + 2y + zexp(z) = f(x,y,z).

You may not always get an elementary function this way, but it is certainly a *function*.

5. Apr 10, 2009

### quantoshake11

i think that may work.. in which case f would have to have an integral with respect to at least one of the variables? .. would a differentiable f be enough?
it kinda confuses me, since the functions don't always have an antiderivative.. i'm gonna think about it, though that answer feels a bit odd, nevertheless it works for a lot of functions (maybe all of them, as you said it would still be a *function*).
by the way, if it helps, f = J dot E where J is the current and E an electric field. Both continuous and differentiable functions R^n -> R^n

Last edited: Apr 10, 2009
6. Apr 10, 2009

### quantoshake11

oh wait.. i actually need that function to make a pass from the volume integral to the surface one using the divergence theorem... so g would need to be bounded, and C^1.. mmm... dammit, i'm getting confused again.. v.v i'm going for a walk

7. Apr 10, 2009

### AUMathTutor

I would say that most functions have antiderivatives. Conspicuous counterexamples come to mind, but they're a little contrived.

Whether or not the antiderivative can be expressed in terms of elementary functions or not... now that's another story. For instance,

f(x) = exp(x^2)

Has infinitely many antiderivatives: F(x) + C, for any C, where F(x) = S f(x) dx

It just so happens that you can't write F(x) using what are called "elementary functions". That doesn't mean that F(x) doesn't define a perfectly good function.

8. Apr 10, 2009

### quantoshake11

and i guess that if the function is made out of antiderivatives, they're continuosly differentiable themselves.. if that's correct then it's solved :D

9. Apr 10, 2009

Suppose you want to find $\vec E$ such that $\nabla \cdot \vec E = \rho$. Let
$$V(\vec r) = \frac{1}{4\pi} \int_{\mathbb{R}^3} \frac{\rho(\vec r')}{\lvert \vec r - \vec r' \rvert} \,d^3 \vec r',$$
and take $\vec E = -\nabla V$. This will also guarantee that $\nabla \times \vec E = 0$.