# Calculating The Reduction Of An Effect With Distance in 2D Space

Does anyone know how to calculate how the intensity of something declines as you move away from it's source? I know that typically such formulas would work in 3D space, but I'm actually after a formula that's more geared towards 2D space.

This is where I've gotten thus far:

Say you have a point that emits an effect on it's surroundings at a certain known intensity (I'll call this value "S"). Naturally, the further away one drifts from the source point, the lower the intensity of this effect will be. Theoretically, the intensity should get lower and lower as the distance from the source increases, but should never reach 0.

Now, obviously under these circumstances, there will be a distance where the intensity is 1/2 that of what is at the source point. I'll call this distance "h". So if that distance is doubled, the reduction of the effect will be double what is experienced at "h", in other words, it will be 1/4 of the source intensity. At a distance of 3 * h, the reduction will be trippled, so the intensity will be 1/6 that of the source. And so on.

Thus I can derive a formula for the intensity ("i") at any given distance ("d"):

$$i = \left(\frac hd\right) * \left(\frac12\right) * S$$

or:

$$i = \frac{Sh} {2d}$$

Which would seem to work pretty neatly - except when you get to a distance of h/2, the formula churns out a value of "S", or source intensity. It gets even weirder if you reduce the distance even further because then you are actually experiencing an intensity even greater then "S"!

Seeing as how the MAXIMUM intensity should only ever be "S", and that the only distance value that should ever deliver this result should be 0, I've obviously made a mistake somewhere.

If anybody knows the actual formula for this problem, I'd be grateful if you'd share it. Once again, I'm really after a 2D-space formula, not a 3D one, which I realize is probably a more obscure formula.

• You've actually done it right, with the mistake being that the maximum intensity isn't limited to S. Imagine if, at distance 0, the intensity was S. Then, if you doubled your distance from the source, the intensity should be halved - but you'll still be at distance 0, and therefore the intensity will still be S. The purpose of the $h$ in your equation is essentially so that you can fix the intensity at a certain distance, and therefore calculate the intensity at any other distance (excluding 0). Commented Dec 8, 2014 at 6:39
• But what if the "S" is a fixed property? e.g. say I have a lightbulb that only emits light in 2 dimensions. I am feeding a known amount of energy into this lightbulb - say 10W, and this lightbulb emits this light out in all directions on a 2D plane. Now I want an equation to determine how much light energy is at any given point within that plane. In this example, h isn't a known property, but because I know that the intensity at h must be 5W worth of energy (1/2 the initial intensity), I might be able to deduce h by finding the point at which I'd recieve 5W of energy from the bulb. Commented Dec 8, 2014 at 8:01
• I've left my response as an answer since the character limit is too small for a comment. Commented Dec 8, 2014 at 8:34

I can see how you might reach that conclusion - in some ways it seems intuitively true - but it's not quite correct. If the light bulb is fed 10W of energy then it is, as you correctly pointed out, distributing 10W of energy as well. But how is that energy distributed? If you were to place a 100% efficient solar panel ring at any arbitrary distance, then that ring must collect 10W of power, by definition - there's just nowhere else for the power to go.

Instead, let's say that we've got a panel on that ring (specifically a curved panel which matches the circle at that distance) which is 1 metre across, but 10 metres away. What would be the circumference of a ring at that distance? It's $2\pi r = 20\pi$. This means that the amount of energy harvested by that panel is $10\times\frac{1}{20\pi}=\frac{1}{2\pi}W$, and that's what we'd refer to as the intensity at that distance. If we were to double our distance, we would be doubling the circumference of the circle, while still having the same sized panel - and therefore we'd be halving the amount of energy collected. In this particular example, the closest the panel could get would be a distance $r$ such that $2\pi r=1$, or $r=\frac{1}{2\pi}$. At that distance, the energy collected is $10\div (2\pi\frac{1}{2\pi})=10W$.

Now let's assume that our panel is particularly special, and that if we decrease the distance below $r=\frac{1}{2\pi}$, the overlapping sections of the panel are both generating power (i.e. they're magically not hiding each other). If, for example, we set $r=\frac{1}{4\pi}$, then the energy collected would be $10\div(2\pi\frac{1}{4\pi})=20W$. Now obviously that doesn't make sense, but that's the point. The formula stops working when you start to get too close to the energy source - because it doesn't actually make sense to be able to get that close. In particular, if you were at a distance of 0 from the source, then no matter the size of the panel you were using, you'll still be harvesting 10W. That in turn means the intensity at that distance is undefined, because even though the power being produced is 10W, it could (theoretically) be harvested with a panel that is infinitely small.

The main question then, is, does your formula need to take into account a situation where the distance from the source will ever be that small? You'll save yourself a lot of trouble if you don't need to consider such a scenario. If you do, then there would be certain ways to approach the issue that recognized the specific parameters of the object on which the intensity is being measured - however these would need to be specialised for your particular scenario.

• Well, long story short, yes I do kind of need to deal with the lower distance values. I'm trying to work out an image manipulation process where a key pixel has a certain defined color. It tries to "pull" all the other pixels of the image to it's own color, but the further away they are, the weaker it's ability to modify their color is. I'd like to be able to have a formula that allows me to modify the "halfway point" value so I can experiment, but I need a formula that will cater to every single pixel between the key pixel and the ring at the halfway point distance. Commented Dec 9, 2014 at 8:10
• But thank you so much for the time you've taken to explain the issue for me. I can see now why I was having so much trouble trying to work out why I couldn't get anywhere when I tried to use a practical scenario to help me figure the problem out. Commented Dec 9, 2014 at 8:14
• I've left another answer for you. Commented Dec 9, 2014 at 13:44

Based on what you said you wanted to do in your comment, there are multiple ways that you can still approach this problem and get a useful solution. First of all (and the one that probably best fits with logic) is that you could have the intensity one pixel away be S (in other words $\frac{h}{2}=1$ giving $i=\frac{S}{d}$). Understandably though, that might not be what you want, since it forces $i=\frac{S}{2}$ at a distance of only two pixels away.

In order to counteract that effect, you can modify your function a bit more. Take, for example, $i=\frac{Sh}{d+j}$. In this case, you want $i=S$ when $d=1$ - i.e. $S=\frac{Sh}{j}$ giving $h=j$. Then when $d=h$, you'll have $i=\frac{Sh}{d+j}=\frac{Sh}{h+h}=\frac{1}{2}$, as you wanted. However there is a problem with this as well - if we move to $d=2h$, we get $i=\frac{Sh}{2h+h}=\frac{S}{3}$ - in other words we've doubled the distance, but we haven't halved the intensity. The intensity will approach 0 as $d$ gets large, but not quite the way you want it to.

You could also potentially try other functions, such as $i=Se^{-\lambda d}$. In such a case, $i=S$ when $d=0$, and you could set $\lambda$ such that $i=\frac{S}{2}$ when $d=h$ - the particular solution would be $\frac{S}{2}=Se^{-\lambda h}$ giving $\lambda=\frac{1}{h}\ln 2$ - so your final formula would be $i=Se^{-\frac{d}{h}\ln2}$, or $i=S\times2^{-\frac{d}{h}}$. In this case, when $d=0$, you get $i=S\times2^0=S$, when $d=h$ you get $i=S\times2^{-\frac{h}{h}}=S\times2^{-1}=\frac{S}{2}$, and when $d=2h$ you get $i=S\times2^{-\frac{2h}{h}}=S\times2^{-2}=\frac{S}{4}$. However in this case, if $d=4h$, then we would get $i=\frac{S}{16}$, which is only a quarter of the intensity at twice the distance. As the distance gets larger, this effect will get worse.

Overall it's really up to you what particular solution you use. Given how you want to use it, any or all of these methods may work for you, but it will probably come down to a bit of trial and error to find the best one. What you want may also be something I haven't listed above, but just another function you find that fits what you need it to do. If you have to have the intensity halving whenever distance doubles, then I'm afraid your only option is to use your original formula. However if you're willing to relax that requirement somewhat, and allow intensity to change in a different method, there will be many options for you to use. Another thing to note is that since you're working with pixels, one would assume there's a maximum distance - therefore you could attempt to find a function that is reasonably close to $\frac{1}{x}$ for values between $x=1$ and whatever your maximum value is, knowing that the value of the function is unimportant outside those bounds.