This is answer is based on the wires in the pictured box were found that way - just hanging loose - and not capped with wire nuts. If they were capped with wire nuts then I would much more likely (but not guaranteed) consider this more of a "are these the right wires - tone/test to find out" situation. But as is...
The problem is you don't know why the previous receptacle was removed from the box. The likely possibilities, which you are counting on, are:
- There was something wrong with this receptacle, so it was removed, leaving these wires hanging. Nobody needed a receptacle here and nobody noticed or cared that another receptacle wasn't working and that was it.
or
- (As suggested by Harper): There was nothing really wrong with the receptacle here, but the previous owner had some reason to remove it - e.g., it was valuable (GFCI? Timer? Dimmer?) or it was flagged as a non-code-compliant device and removed. But the previous owner did it himself and didn't bother to cap the wires and didn't know or care about the other receptacle that stopped working.
But it is also possible:
- Something was wrong with the circuit in general - e.g., the breaker wouldn't reset. Somebody removed this receptacle as part of the troubleshooting process. The problem went away. Nobody needed a receptacle here and, while they knew the other receptacle (the one you are trying to fix) wasn't working, they didn't care because the rest of the circuit was working again.
You have no way of knowing which of these scenarios (or some other one I haven't thought of) actually happened. As a result, while it is easy enough to connect these wires together and see if the receptacle works, you might be reactivating an old problem, such as:
- A bad connection at the receptacle you are trying to fix, that might arc and cause a fire.
- A damaged wire between this missing receptacle and the receptacle you are trying to fix, which might cause an intermittent hard to find until it is too late problem, causing a fire.
- A damaged wire leading from the previous receptacle to this missing receptacle that has a problem that isn't evident when there is no current flowing (as there hasn't been since the receptacle was removed).
You simply don't know.
Are there ways to check things out? Yes. You can test the wires in each section to make sure they are low resistance and not shorted. You can check (even replace) the broken receptacle to avoid any problems there. But you are starting in a really bad place - with a receptacle that was removed and the wires were not properly capped. So you really don't know what is going on with these wires.
Anyone who would leave the wires hanging doesn't know electrical safety 101. What other problems might be lurking???